LuaSnip icon indicating copy to clipboard operation
LuaSnip copied to clipboard

`ext opts` for (un)visited nodes.

Open L3MON4D3 opened this issue 3 years ago • 0 comments

As proposed in #410. For now the inheritance is (with arrows to gets-and-extends-ext_opts-from from)

flowchart TD
	passive --> active
	passive --> visited
	passive --> unvisited
	snippet_passive --> passive

although that feels a bit weird, maybe it would be better to combine ext_opts from visited and unvisited for active.

One example:

ls.setup_snip_env()

local node_ext_opts = {
	visited = {
		hl_group = "GruvboxPurple"
	},
	unvisited = {
		hl_group = "GruvboxBlue"
	},
}

ls.add_snippets("all", {
	s("trig36", {
		t{"no indent"}, c(3, {
			t"a",
			t"b",
			t"c"
		}, {
			node_ext_opts = node_ext_opts
		}), i(2, "some text"), i(1, "some text")
	}, {
		child_ext_opts = {
			[types.insertNode] = {
				passive = {
					hl_group = "GruvboxRed"
				},
				visited = {
					hl_group = "GruvboxOrange"
				},
				unvisited = {
					hl_group = "GruvboxYellow"
				},
			}
		}
	})
}, {
	key = "test"
})

Needs docs and tests.

L3MON4D3 avatar May 24 '22 18:05 L3MON4D3