saadparwaiz1/cmp_luasnip

JSON snippets with autotrigger not in cmp menu

lambtho12 opened this issue · 5 comments

Luasnip's commit @737a2e7 introduced the possibility to specify a "luasnip" field in a snippet JSON file so the snippets can autotrigger.

If that field is set and autotrigger is true, the snippet will not be listed in the nvim-cmp menu. I believe it should show up in the cmp menu, no matter the autotrigger behavior.

Example snippet config

  "uuid": {
    "prefix": "UUID",
    "body": [
      "${CURRENT_YEAR}${CURRENT_MONTH}${CURRENT_DATE}${CURRENT_HOUR}${CURRENT_MINUTE}"
    ],
    "description": "UUID",
    "luasnip": {
      "autotrigger": true
    }
  },

We don't do any filtering by autotrigger here. Unless autotrigger implies hidden?

Edit:

Never mind just saw that auto triggered snippets are stored in a different table. @L3MON4D3 do you want the auto trigger snippet table to show up in the completion menu or is it hidden by design. I can update the plugin once you give the go ahead :)

I think they were hidden by design (and comfort, one less table to scan ;) ), I figured that autosnippets wouldn't be triggered via the completion-menu but, you know, automatically :D
If there's demand for adding them, that shouldn't be a problem (autosnippets require a CharInsertPre to be expanded, but that isn't triggered while scrolling through the completion options)

I personally have a large amount of snippets. It is not always easy to remember all of them and this is why I like to have visual clues when I start typing one.

If it does not impact performance and it does not autotrigger when scrolling over, I do not see any real reason to not list them as well.

Bit hesitant about implementing this just because I think competition menu should only show snippets that have to be triggered manually but I'll create a pull request for this and we can discuss more :)

you can try out #27 to see if this fixes it for you