-
Notifications
You must be signed in to change notification settings - Fork 17
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
Document how to setup extended clientCapabilities #30
Comments
It depends on language server that you are using. Most of language servers do not support all kinds of file operations. |
It's eclipse.jdt.ls via nvim-jdtls. To clarify: It does work - but only if I let neovim report the above client capabilities. Correct me if I'm wrong, but what I think how it works:
Without my above change the server response did not include |
To clarify: |
I get it now. We add recipes for specific language servers to the wiki You can also open a pr and add it to readme if you want. |
So you did not have this problem? Then maybe LSP servers behave differently and only jdt.ls has this problem. If you think it makes sense I can still provide a PR for the README later. |
I mostly use metals language server for scala with https://github.com/scalameta/nvim-metals local capabilities = vim.lsp.protocol.make_client_capabilities() But still metals language server returns everything. I think it is ok to add some specific instructions to the readme, it might save people time. |
What do you think about providing a utility method that returns the capabilities to add? That's how cmp-nvim-lsp does it. It can be used to extend nvim's default capabilities as suggested here. It would look like this: local lspconfig = require'lspconfig'
local cmp_nvim_lsp = require'cmp_nvim_lsp'
local lsp_file_operations = require'lsp-file-operations'
local util = lspconfig.util
-- Set global defaults for all servers
util.default_config = vim.tbl_extend(
'force',
util.default_config,
{
capabilities = vim.tbl_deep_extend(
"force",
vim.lsp.protocol.make_client_capabilities(),
cmp_nvim_lsp.default_capabilities(),
lsp_file_operations.default_capabilities(),
)
}
) |
Issue #30 Add utility to get client capabilities for LSP server config
I'm not sure if I missed anything, but for me the default setup is not enough, because nvim will not include the corresponding capabilities in the LSP
initialize
request.So for
nvim-lspconfig
I had to add something like this to my config:Shouldn't this be mentioned in the README?
The text was updated successfully, but these errors were encountered: