Breaking Changes
Drop support for neovim < 0.7.
Since this probably affects very few users, and enables access to some better api, this decision was obvious.
Highlights
Multi-Context snippets
This essentially makes it possible to trigger one snippet in different ways. For example, one may want to trigger a snippet with a short trigger manually, but use a longer one as an autotrigger. Or, expand a snippet automatically in comments, and manually otherwise (or, and maybe more likely, vice versa).
The DOC.md
-entry is pretty comprehensive, so I won't repeat it here.
Snippet-Source
If loaders_store_source
is set to true
in ls.setup
, the loaders will attach information about the source of a snippet (like file, row, column of its definition).
We of course also include a consumer for this information: luasnip.extras.snip_location
can jump to the source of the current snippet!
Combined with auto-reload provided by the loaders, this allows quick edits of the current snippet, for example if it does not behave correctly.
For easy access, create a command for calling the function.
vim.api.nvim_create_user_command("LuaSnipEditS", require("luasnip.extras.snip_location").jump_to_active_snippet, {})
1689692600.mp4
To work correctly for all loaders, this needs treesitter
, and parsers for json (jsonc if there are snippet-files in that format) and lua.
Key-indexer
This can be used to easily refer to nodes (for example, if their text should be passed to a dynamic/functionNode) several levels deep in a snippet, simply by a unique identifier. Once again, the documentation has some details+examples.
.code-snippets
Support for the .code-snippets
-format used by vscode was also added since the last release. It is useful for project-specific snippets, and a bit more compact than the other formats, since only a single file has to be added, not a directory (and god forbid, not a package.json
which has to correctly list all files).
More here.
More trigger-types!!
Finally, support for actual regexes as snippet-triggers. Supports ecma and vim-flavoured regex, as well as completely custom behaviour. The documentation (look for the trigEngine
-entry in the first list) has some more details.
PR's since last release:
- Move config reference to DOC.md, update links by @runiq in #755
- Update New User Resources on README + Proofread by @evesdropper in #763
- Extend default
snip_env
by default. by @L3MON4D3 in #765 - refactor with some newer apis by @max397574 in #777
- Remove vim.fn.json fallbacks by @leiserfg in #778
- Get destination-node of next jump (close #676) by @L3MON4D3 in #740
- Prefer vim.filetype.add over ftdetect scripts by @leiserfg in #782
- Optionally use lua-jsonc parser for parsing vscode-snippets. by @L3MON4D3 in #783
- Multi-context-snippets by @L3MON4D3 in #774
- Fix a loader bug: from_lua by @dwainm in #820
- add
ft_filter
toedit_snippet_filetypes
(close #635). by @L3MON4D3 in #812 - Reformat doc a bit by @L3MON4D3 in #808
- Parameterise LuaJIT path on OSX by @giang-nghg in #824
- Add nix support to Makefile by @chuwy in #842
- fix:
expand_or_locally_jumpable()
checks the next node by @loichyan in #860 - delete has_selected_text.lua + move contents to show.lua by @JxJxxJxJ in #849
- fix(makefile):compile jsregexp with luajit installed by linuxbrew by @menghuu in #861
- doc: mention MacOS Makefile variable for jsregexp by @fejzuli in #866
- Adding comments in installation examples by @Curs3W4ll in #863
- Generate source for loaded snippets. by @L3MON4D3 in #826
- fix: vim.pretty_print is deprecated (^neovim-0.9.0) by @ssayin in #880
- fix(docs): type annotation can by nil by @kunzaatko in #889
- Keyed nodes by @L3MON4D3 in #838
- Improve rgrav-adjustments by @L3MON4D3 in #852
- feat: add default condition for postfix by @MunifTanjim in #898
- Several improvements. by @L3MON4D3 in #906
- fix: use relative url for submodule definition (#911) by @gongfarmer in #912
- Merge multi-snippet common field, fix #921 by @Bekaboo in #924
- refactor: don't load modules in lazy_load until they are needed by @stasjok in #926
- fix: remove debug print by @stasjok in #930
- Implement more trigger-types by @L3MON4D3 in #923
- Subtraction for condition objects by @bhataktaBhai in #945
- fix: install jsregexp by @henryhchchc in #960
Big Thank You! to all new contributors :)
- @runiq made their first contribution in #755
- @evesdropper made their first contribution in #763
- @max397574 made their first contribution in #777
- @dwainm made their first contribution in #820
- @giang-nghg made their first contribution in #824
- @chuwy made their first contribution in #842
- @loichyan made their first contribution in #860
- @JxJxxJxJ made their first contribution in #849
- @menghuu made their first contribution in #861
- @fejzuli made their first contribution in #866
- @Curs3W4ll made their first contribution in #863
- @ssayin made their first contribution in #880
- @MunifTanjim made their first contribution in #898
- @gongfarmer made their first contribution in #912
- @Bekaboo made their first contribution in #924
- @stasjok made their first contribution in #926
- @bhataktaBhai made their first contribution in #945
- @henryhchchc made their first contribution in #960
Full Changelog: v1.2.1...v1.3