L3MON4D3/LuaSnip

Regex with capture groups appear in the list of available mappings

Opened this issue · 1 comments

Given the following snippets:

  s({ trig = "(%w+)tmap", dscr = "Wrap current table with a map method", regTrig = true }, {
    t "vim.tbl_map(",
    l(l.CAPTURE1, {}),
    i(0),
    t ")",
  }),

I don't expect it to appear when I type a literal parenthesis as an expansion option, but it does:

image

The problem is that cmp_luasnip currently uses exactly the trigger.
One solution is omitting non-terminal characters, another (and I think this is nicer) would be implementing the option itemName to control the name that shows up in nvim-cmp.

Better open an issue in cmp_luasnip, it's better suited for this discussion I'd say
(Leave this issue open though, the second approach would include changes to luasnip, this can be closed when those are implemented)