Skip to content

How to prefer luasnip over lsp ? #361

Answered by VonHeikemen
lotusirous asked this question in Q&A
Discussion options

You must be logged in to vote

The easiest way I can think of is moving the luasnip source above nvim_lsp. That will change the "priority" of the completion items.

sources = {
  { name = "path" },
  { name = "luasnip"},
  { name = "nvim_lsp" },
  { name = "buffer", keyword_length = 3 },
  { name = "nvim_lsp_signature_help" },
},

My personal preference is to have different keyword_length. So luasnip suggestions will appear on 2 keystrokes, and the lsp appear after 3 keystrokes. But I still keep the lsp with higher priority.

sources = {
  { name = "path" },
  { name = "nvim_lsp", keyword_length = 3 },
  { name = "buffer", keyword_length = 3 },
  { name = "luasnip", keyword_length = 2 },
  { name = "nvim_lsp_signature_help" 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lotusirous
Comment options

Answer selected by lotusirous
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants