-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
Snippet Priority #268
Comments
#334 implements a first attempt at allowing snippet-priorities, priorities can only be used manually for now, but that will be improved. |
IMHO user-added snippets should have a higher priority than loaders by default (so they don't get overridden by external ones), and loaders should write directly to the inner structure to avoid the meta-table (that last one is maybe an overoptimization but measuring is the only way to know). |
I agree, but I'm not sure how we can separate them. Loaded snippets may also be user-added and not from some snippet-library.
Right, that's something to keep in mind if just setting them turns out to be too slow👍 |
Maybe setting the snippets added to the |
Mhmm maybe, that would definitely be smoother as long as snippets are mainly set via lua. |
I can think of two options:
|
Extending the package.json sounds like a good idea, maybe we can get friendly-snippets (or other collections) to set theirs to 500. I'd also extend the current |
Okay, priority can now be set in the call to What's missing is using priority in loaders, I'm merging the patches without it because I want to get the breaking changes out. |
Done (see here) 🎉 :D |
There is no explicit way to give snippets a priority, only implicitly through the order they are added to the
ls.snippets.<filetype>
-table (scanned sequentially, return on first match).As there are some limitations on ordering snippets as well (adding lua-snippets behind those loaded from a snippet-package (see #267), no defined order of snippets loaded from different packages) we should properly implement priority.
load
-functions to set it on the whole collection (allows overriding snippets from something likefriendly-snippet
with custom ones)That's all the requirements I can think of, feel free to suggest more :)
The text was updated successfully, but these errors were encountered: