-
-
Notifications
You must be signed in to change notification settings - Fork 265
Open
Description
I want to create a snippet such that it allows repeating jump-able nodes. Meaning that, for example, I have a snippet that has two nodes an insertNode(1) and a dynamicNode(2) such that the dynamic node allows me to (recursively) choose between an empty string with t("") or "repeat" whatever I inserted with insertNode(1).
This is do-able with
local function repeat(args)
return sn(nil, c(1, {
t(""),
sn(nil, { i(1), sn(2, t(args[1][1])), d(3, repeat, 2, {}) }),
}))
end
ls.add_snippets("all", {
s({trig="tab", desc="Recursive jumps?",}, {
i(1),
d(2, repeat, 1, {}),
}),
}I took inspiration from rec_ls in the examples for the above and it works as expected as long as args <- insertNode(1) is plain static text. If I insert another jump-able snippet at 1, I want 2 to expand to that and allow the jumps as well and not just the text that was inserted at 1. I hope I could explain my intended behavior.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels