-
-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support .code-snippets
.
#894
Conversation
.code-snippet-cache is not compatible.
Don't separate those into two tables, we no longer need to do that.
1c235e3
to
4a4b245
Compare
@L3MON4D3 I would say this is rather a rough solution... What's the purpose of the cache in short? Lack of comments for that code actually prevents any sensible contributions. |
Oh, why would you say this is rough? And where do you think more comments would help? |
0f2969f
to
b45368b
Compare
1f49347
to
332f6a5
Compare
Why not every |
Well, I still think we should be able to have I wouldn't want to config snips paths in different places (some lua file, etc). It's logically reasonable to have paths in |
|
Oh, that's (or should be, at least) implemented via 6a46f76 |
27c493b
to
063d60e
Compare
Although, on second thought, it wouldn't lead to much more complexity, and would be pretty cool for |
It ain't. It's logical for a snippet to have an associated file type. This way the function that applies snippets may sort them out in advance and update them on demand. |
It's also logical to group ones own snippets by filetype :P |
@L3MON4D3 This is why I'm advocating the E.g.:
{
"name": "snippets",
"contributes": {
"snippets": [
...
, { "language": [ "markdown" ], "path": "./markdown.code-snippets" }
...
]
}
} |
I don't understand what that example is supposed to show me, could you explain in more detail? |
But, maybe do so in another issue if it's actually about another feature, this is getting off-topic I think |
I made a small mistake. It's supposed to show you how to load |
Ah, okay |
Not a problem. The
I told you elsewhere alredy that I have a collection of snippets that I've separated by specific tools and purpose. It would be outright stupid to keep all these in one single per-language
I prefer to keep my snips in a cross-platform format actually. Except for LuaSnip, which is kinda different. Would be best if it would b 90% convertible to vscode/textmate format in the future. |
Ah okay, okay, now I'm convinced😅 |
Replied elsewhere already. (scope is ignored afaik) |
Oh, I kinda though I must've misunderstood something there, because you were talking about wanting to have compatibility/a standard format. |
Oh, |
BTW, if you want 100% compatibility the VS Code it says that the You should use empty string instead as there is no {
"contributes": {
"snippets": [
{
"language": "",
"path": "./snippets/foo.code-snippets"
}
]
}
} This way snippets are imported and filtered based on
It's likely won't accept it. See the first screenshot (spot the error). |
I think making LuaSnip 100% compatible with VS Code extension isn't important. Though, the recent findings make it hard to hint engine on what kind of snippets |
Wait, so if |
Oh you can easily test that, load something like |
We can use the following hinting approach (using the same file twice): {
"contributes": {
"snippets": [
{
"language": "go",
"path": "./snippets/collection.code-snippets"
},
{
"language": "rust",
"path": "./snippets/collection.code-snippets"
},
]
}
} This way engine may figure to use cached file to avoid loading it twice and filter snippets based on
|
Hah, it used to be way worse. We used to parse the snippets outright, this is just reading+parsing json and adding them a kind of proxy, which parses them on expand
Filtering with |
(if the same snippet is used, it won't be possible to invalidate one, but not the other)
5409264
to
b8d4d15
Compare
Decoupling the filetype(s) which trigger a One cool thing that is possible with that is setting the I'm going to implement this here, since it simplifies the implementation of |
@L3MON4D3 What's the bottleneck of loading snippets? |
I suspect that right now, it might be copying around of snippets, but I'm working on that right now |
Continued in #906 |
Both in
package.json
-style snippet-packages and as standalone files, where snippet-filetypes have to be set viascope
.