saadparwaiz1 / cmp_luasnip

luasnip completion source for nvim-cmp
Apache License 2.0
687 stars 32 forks source link

Sources appear in `LuaSnipListAvailable` but not in cmp suggestions list #50

Open bennypowers opened 1 year ago

bennypowers commented 1 year ago

Hey I've got a bunch of snips in LuaSnipListAvailable like this one:

{
      description = { "Alert - Info background" },
      name = "rh-color-blue-50",
      regTrig = false,
      trigger = "--rh-color-blue-50",
      wordTrig = true
}

loaded via

require 'luasnip.loaders.from_vscode'.lazy_load { paths = {
  '~/Developer/redhat-ux/red-hat-design-tokens/editor/vscode'
} }

sources config is

  sources = cmp.config.sources({
    { name = 'nvim_lsp' },
    { name = 'nvim_lsp_signature_help' },
  }, {
    { name = 'luasnip', option = { use_show_condition = false } },
  }, {
    { name = 'treesitter' },
    { name = 'buffer', keyword_length = 3 },
  }, {
    { name = 'plugins' },
    { name = 'nvim_lua' },
    { name = 'npm', keyword_length = 4 },
    { name = 'fish' },
    { name = 'calc' },
    { name = 'emoji' },
  }),

but none of them are showing up when i type --rh-color. Y?

config: https://github.com/bennypowers/dotfiles/blob/master/.config/nvim/lua/config/cmp.lua vscode extension bundle: https://github.com/RedHat-UX/red-hat-design-tokens/releases/tag/v1.0.0-beta.9

danrot commented 1 year ago

I want to kindly bump this issue, since I have the same problem 😕

saadparwaiz1 commented 1 year ago

Are you using the native cmp pop up menu or the floating window?

native menu doesn't work with characters that are not alphabetical. So if you change the trigger to remove any non alphabetical characters it should work.

bennypowers commented 1 year ago

So this is the issue? https://github.com/bennypowers/dotfiles/blob/d5e010b22246ab22b044241498f1544f6b9c1fab/.config/nvim/lua/config/cmp.lua#L9

saadparwaiz1 commented 1 year ago

So this is the issue?

https://github.com/bennypowers/dotfiles/blob/d5e010b22246ab22b044241498f1544f6b9c1fab/.config/nvim/lua/config/cmp.lua#L9

Yeah can you set it to false and see if it is fixed?

danrot commented 1 year ago

For me it was another issue, I am just writing it here in case anybody else experiences the same issue:

I wanted to use my ultisnip snippets, and they have a different format... After I realized that I misread the luasnip documentation and wrote the snippets wrong:

snippet php vd
    var_dump($0);die();

In the documentation it looked to me like I need to set the language after the snippet keyword, which is not the case.

saadparwaiz1 commented 1 year ago

@bennypowers can you confirm if turning the native menu off fixed the issue for you?

bennypowers commented 1 year ago

Gonna check in a few days, I'm traveling now On 30 Oct 2022, 09:46 -0400, saadparwaiz1 @.***>, wrote:

@bennypowers can you confirm if turning the native menu off fixed the issue for you? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

bennypowers commented 1 year ago

This didn't help, neither did removing the dash chars from the snippet names:

Screenshot from 2022-10-31 14-36-32 Screenshot from 2022-10-31 14-33-12 Screenshot from 2022-10-31 14-33-04

bennypowers commented 1 year ago

I have this problem with all my snippets, whether defined as lua snippets, snipmate, whatever.

If i restart nvim, I can see ONLY my snipmate snippets in the popup menu for one or two seconds, until the typescript lsp server comes online. After which, the snipmate snippets disappear and are replaced by LSP snippets - at that point, ONLY LSP snippets are available.

Screencast from 2023-01-08 09-49-03.webm

KevinRizzoTO commented 1 year ago

I also seem to be having this issue 🤔 Mappings that start with non-alphabetical characters (e.g <) don't seem to work. I say the comment above about this being expected for the native menu. However, I didn't set this option anywhere. The only reference I see is outlined in the nvim-cmp wiki but it's an experimental feature that I haven't enabled.

Happy to help with any debugging! I could use a bit of assistance with where to look though.