1.1.0
Deprecations
extras.expand_conditions
See here
Necessitated by the subsequently introduced condition-objects.
Notable additions
Autotrigger-option for individual snippets (by @atticus-sullivan)
Previously the autotriggered-feature for a snippet could only (somewhat implicitly) be specified when adding snippets (add_snippets(..., {type = "autosnippets"}) or put the snippet into the second table returned by lua-loader-loaded files). This was originally due to a limitation (snippets had to be assigned to different tables ls.snippets or ls.autosnippets, as the OGs will remember :P) which has not existed for a while, and now we finally make use of its removal.
Basically:
ls.add_snippets("all", {
s({trig = "trig", snippetType = "autosnippet"}, {
t"autotriggerd"
})
})Will add the autotriggered snippet, without passing additional parameters to s.
For extra style, one may
local autosnippet = ls.extend_decorator.apply(s, {snippetType = "autosnippet"})so autotriggered snippets can be easily created with autosnippet.
The old ways of creating autosnippets are still present, and not deprecated, so for adding bigger collections of snippets as autosnippets, they can be used as well.
Condition-objects (by @atticus-sullivan)
Condition-objects!! They are useful for combining multiple conditions into logical expressions:
-- two show-conditions
local function even_line()
-- omitted
end
local function line_end()
-- omitted
end
-- without condition-objects:
s(
-- omitted
{
show_condition = function(...)
return even_line(...) and line_end(...)
end
-- show-conditions can also be passed to `condition`!
condition = function(...)
return even_line(...) and line_end(...)
end,
})
-- with condition-objects:
local make_condition = require("luasnip.extras.conditions").make_condition
local even_line_obj = make_condition(even_line)
local end_line_obj = make_condition(end_line)
s(
-- omitted
{
-- "*" for `and`
show_condition = even_line_obj * line_end_obj
condition = even_line_obj * line_end_obj
})Much more readable!
There are more details in the doc
Big Documentation overhaul (by me!)
The doc is now much more coherent and detailed, and concepts like jump-index
(i(1) <- that number) and node-reference (f(somefunction, {1,2}) <- those
numbers) are properly explained (and consistenly named!)
Readme (by @ejmastnak)
This is a smaller addition, but important nonetheless: The readme now
contains an improved Getting Started-section, and a section for external
resources (Videos, blogs, articles, anything really) on luasnip. Feel free to extend it!
Smaller additions
- feat: Add new locally_jumpable(direction) function by @mike325 in #587
- feat: add new built-in condition for line ending by @weilbith in #597
- fix typo emtpy to empty by @ecerulm in #601
- fix(snipmate): correctly escape backtick by @danilshvalov in #604
- doc: fix tiny typo its' -> its by @ejmastnak in #609
- Return a better error when from_lua loader fails by @robertgzr in #610
- Give a valid exmple for loaders.from_lua by @YuanYuYuan in #620
Full Changelog: v1.0.0...v1.1.0