hrsh7th / cmp-nvim-lsp

nvim-cmp source for neovim builtin LSP client
MIT License
1.24k stars 48 forks source link

Cannot disable completion for a specified client #24

Closed przepompownia closed 2 years ago

przepompownia commented 2 years ago

I use a language server for which I want to disable the most of capabilities (it's too slow on some projects). Currently it does not disable any capability given restricted set of capabilities on initialization.

I noticed that restricting client.resolved_capabilities within on_attach can also prevent from using some method of client but completion is an exception.

Shouldn't source:is_available() return false if self.client.resolved_capabilities.completion is false?

Shougo commented 2 years ago

You cannot use the config? https://github.com/hrsh7th/nvim-cmp/issues/822#issuecomment-1056103013

If so, it is the LSP server problem instead of nvim-cmp. LSP server must support the capability.

przepompownia commented 2 years ago

Thanks, however I've seen before in source:is_available() that overriding server_capabilities.completionProvider can be another workaround (and works).

In general, what is "the proper way" to override the server capabilities (i.e. whether not checking resolved_capabilities.completion is correct)?

https://github.com/neovim/neovim/blob/a7c999523dbcbb91db56c6eb834034d448e9481c/runtime/lua/vim/lsp.lua#L1469-L1474 https://github.com/neovim/neovim/blob/a7c999523dbcbb91db56c6eb834034d448e9481c/runtime/lua/vim/lsp.lua#L966-L974

Independently, I have no doubt that this is a server problem in particular :wink:

hrsh7th commented 2 years ago

See :h cmp-nvim-lsp