Saghen / blink.cmp

Performant, batteries-included completion plugin for Neovim
MIT License
632 stars 27 forks source link

Default capabilities #13

Open victor4pinheiro opened 3 days ago

victor4pinheiro commented 3 days ago

I added this plugin to my config and although I only use the basic completions, a little thing surprised me. When using nvim-cmp, to broadcast to servers, we're supposed to do something like that:

local capabilities = require('cmp_nvim_lsp').default_capabilities()

  -- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
  require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
    capabilities = capabilities
  }

But I see that this plugin doesn't need it (or I believe it's not needed). My first thoughts is that while all plugins that use LSP broadcast to servers that use the native vim.lsp and this plugin just use the results of this.

Could you explain what is the difference and why I don't need to do this anymore, please?

Saghen commented 2 days ago

Capabilities tell the LSP which features the client supports. nvim-cmp uses this since it supports many features that the built-in completions did not (and some that still aren't). Many capabilities have been enabled by default since that plugin was written. So far, I've been using the defaults but will likely need to adopt this in the future

victor4pinheiro commented 2 days ago

Thanks for answer!

chrisgrieser commented 1 day ago

I gave this a try, and both cmp and blink.cmp work in most LSPs without the capabilities snippet. However, for the css_ls, both plugin do require the capabilities snippet to work.