This restores the pre-d9cb6ab-behaviour of completely leaving a snippet once $0 is reached, instead of leaving the possibility of jumping back into it.
This behaviour can be turned on or off via `exit_roots`, and, like the other settings that superseded `history`, `exit_roots` will be set s.t. `history` still/again behaves as expected.
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
Before this, upon expanding a new snippet, its jumps were linked up
with the currently active node, no matter its position in the buffer.
The most prominent negative side-effect of this is jumping all over the
buffer if a snippet is not jumped "through" (ie. to its $0).
This finally adresses this properly by inserting snippets into nodes
according to their position in the buffer.
Read the changes to `DOC.md` for more info.
This commit also deprecates `history` in `setup`, prefer the new options
`keep_roots`, `link_roots`, and `link_children`, as they are more
readable. Still, it is very unlikely that compatibility with `history`
will ever be completely removed, so no need to fret about this.
Added an explanation regarding the behaviour of snippet expansion when multiple snippets can potentially expand at the current buffer-position. Re-structured DOC.md to separate Troubleshooting advice into its own section.
Nodes can be explicitly given some key, and this key can be used in the
args-parameter passed to function/dynamicNode.
This basically makes absolute_indexer useless, since non-sibling nodes
can be addressed much clearer by giving them some key/name, and using
that to reference them, as opposed to reconstructing their exact path
from the snippet-root and passing that.
Furthermore, now all kinds of nodes can be depended on (for example
functionNode)
Lastly, a keyed node can be retrieved via `snippet:get_keyed_node(key)`
in dynamicNode, which can enable more complicated snippets.
The LUAJIT_OSX_PATH variable which allows MacOS users
to specify the location of their lib directory was added in
a835e3d680
and needed to be documented.
Much more comfortable than having to basically copy the defaults from
the source code just to add a few functions to the snip_env.
It's still possible to get the old "set"-behaviour by passing
`__snip_env_behaviour = "set"` in the `snip_env`.
- remove some dashes (human readability, though let me know if that might disrupt the actual documentation)
- comma adds/rms
- fix spacing on postfix snippet code highlights