-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
Several improvements. #906
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
L3MON4D3
force-pushed
the
vscode-code-snippets-2
branch
2 times, most recently
from
May 29, 2023 18:16
3fe39cb
to
73dff88
Compare
Alright, I think that should be it. |
Useful for lsp-snippets which belong to multiple filetypes.
`.code-snippet`-cache is not compatible.
id is specified per-virtual-snippet (if there is a snippet which is added, via multisnippet, to two filetypes X and Y, the snippet expanded from filetype X will have an id different from that for filetype Y).
For inserting the same addable/expandable to multiple filetypes, without deep-copying.
Maybe it should even exclusively consider load_ft_func-filetypes, since the intent of the function, at least as I see it, is to add a snippet to any filetype for this buffer, and thats exactly the association load_ft_func is supposed to model.
L3MON4D3
force-pushed
the
vscode-code-snippets-2
branch
from
May 31, 2023 09:36
e08e894
to
f359928
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This has multiple more-or-less interdependent improvements, hence me doing this in one PR:
Snippet-filetype can be overridden via
filetype
-setting incontext
will be added to lua even if it is in an
add_snippets
-call to another language.This may seem a bit weird at first, but is actually useful since it decouples
the loaded filetype (language in
package.json
, "filetype.lua/snipmate")from the filetype of the added snippet. This allows doing something like
grouping snippets by some property other than its filetype (for example all
snippets for some framework together) which wasn't as nicely doable before
(it was possible by splitting snippets by framework and filetype, but this is
better).
Also allows adding a single snippet to multiple filetypes via multisnippet.
Some performance/functional improvements for loaders.from_vscode. It's a bit
cleaner now, uses multisnippet for multi-filetype/multi-trigger snippets
(scope/prefix can have multiple entries), and does not deepcopy snippets, but
uses
duplicate_addable/expandable
, a kind of thin wrapper around theoriginal snippet which allows it to be added to multiple filetypes, without
invalidate
removing all snippets (kind of complicated :/).Finally, support for loading
.code-snippets
standalone, without apackage.json
.