Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling cmp-path hides snippets that start with a slash #62

Open
rudism opened this issue Jan 12, 2023 · 0 comments
Open

Enabling cmp-path hides snippets that start with a slash #62

rudism opened this issue Jan 12, 2023 · 0 comments

Comments

@rudism
Copy link

rudism commented Jan 12, 2023

Using luasnip, snippets that start with a / or . character don't show up in the completion menu when the path source is enabled in the nvim-cmp config.

nvim-cmp config:

cmp.setup {
  snippet = {
    expand = function(args)
      require'luasnip'.lsp_expand(args.body)
    end,
  },
  mapping = {
    ['<Tab>'] = cmp.mapping.select_next_item(),
    ['<S-Tab>'] = cmp.mapping.select_prev_item(),
    ['<CR>'] = cmp.mapping.confirm({
      behavior = cmp.ConfirmBehavior.Replace,
      select = false,
    })
  },
  preselect = cmp.PreselectMode.None,
  confirmation = { get_commit_characters = function(_) return {} end },
  sources = {
    { name = 'luasnip' },
    { name = 'nvim_lsp' },
    { name = 'buffer' },
    { name = 'path' },
  },
}

luasnip config:

require('luasnip.loaders.from_snipmate').lazy_load({
  paths = "~/.config/nvim/snippets"
})

Example snippet definition:

snippet ///
	/// <summary>
	/// ${0}
	/// </summary>

Expected Behavior

Typing /// should show the defined snippet in the completion menu, however instead it only shows path completions for files at the root file system:

image

If I disable the { name = 'path' } source from the nvim-cmp config then it works as expected:

image

Is there some way to configure it so that both of these things can work together that I'm missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant