LuaSnip/lua/luasnip/_types.lua
L3MON4D3 ce400352e6 feat: major overhaul of loaders. Check DOC.md-changes for the gist.
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
2023-12-02 16:24:58 +01:00

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().