mirror of
https://github.com/L3MON4D3/LuaSnip
synced 2024-09-16 21:54:03 +02:00
ce400352e6
Previously, we could not * add files that were not present when `load/lazy_load` was called to the collection. This is pretty annoying if one wants to add project-local snippets, or snippets for a new filetype (ofc). * load collections whose directory/package.json(c) did not exist when `load` was called. This is also an annoyance when creating project-local snippets, since a re-`load()` is required for the snippets to be picked up. * pick up on changes to the snippet-files from another neovim-instance (due to reloading on BufWritePost) This patch fixes all of these by modularizing the loaders a bit more, into one component ("Collection") which takes care of all the logic of loading different files, and another ("fswatchers") which notify the collections when a file-change is detected. This allows, first of all, a better design where the first concern can be nullified, and secondly, us to use libuvs api for file-watching, to implement the last two (if a potentially non-existing collection should be loaded, we can use libuv to wait for the collection-root/manifest-file, and create the collection once that exists). Another cool addition is the loader-snippet-cache, which makes it so that the snippet files (for vscode and snipmate) are only loaded once for all filetypes, and not once for each filetype. That's probably not noticeable though, except if a collection with many extends/languages for one json-file is loaded :D
8 lines
313 B
Lua
8 lines
313 B
Lua
---@alias LuaSnip.Cursor {[1]: number, [2]: number}
|
|
|
|
---@class LuaSnip.MatchRegion 0-based region
|
|
---@field row integer 0-based row
|
|
---@field col_range { [1]: integer, [2]: integer } 0-based column range, from-in, to-exclusive
|
|
|
|
---@alias LuaSnip.Addable table
|
|
---Anything that can be passed to ls.add_snippets().
|