modules/luasnip: add choices to avoid choice kind
This commit is contained in:
parent
aeb09834d6
commit
881339ef70
1 changed files with 5 additions and 3 deletions
|
@ -39,6 +39,7 @@ let
|
|||
};
|
||||
|
||||
inherit nodes;
|
||||
choices = nodes;
|
||||
|
||||
# only for kind=snippet
|
||||
indentString = mkOption {
|
||||
|
@ -51,13 +52,14 @@ let
|
|||
|
||||
config =
|
||||
let
|
||||
inherit (config) kind text jump nodes;
|
||||
inherit (config) kind text jump nodes choices;
|
||||
|
||||
unwrapJump = index: if index == null then LuaNil else index;
|
||||
in
|
||||
{
|
||||
kind = lib.mkDefault (
|
||||
if nodes != [ ] then "snippet"
|
||||
if choices != [ ] then "choice"
|
||||
else if nodes != [ ] then "snippet"
|
||||
else if jump != null then "insert"
|
||||
else "text"
|
||||
);
|
||||
|
@ -67,7 +69,7 @@ let
|
|||
if text != null then call1 "t" text
|
||||
else throw "luasnip textnode require a 'text' config"
|
||||
else if kind == "insert" then call "i" [ (unwrapJump jump) text ]
|
||||
else if kind == "choice" then call "c" [ (unwrapJump jump) (unwrapNodes nodes) ]
|
||||
else if kind == "choice" then call "c" [ (unwrapJump jump) (unwrapNodes choices) ]
|
||||
else if kind == "snippet" then
|
||||
if config.indentString != "" then
|
||||
call "isn" [ (unwrapJump jump) (unwrapNodes nodes) config.indentString ]
|
||||
|
|
Loading…
Reference in a new issue