How to config multiple lsp for document hover?

I’m using jedi_language_server and pyright at the same time. However I found jedi provide more useable document, but when I run lua vim.lsp.buf.hover(), sometimes document hover come from pyright and sometimes jedi. Is there a way I can custom the order of LSP sources, for document hover specifically.

This was a little tough to figure out for me as well. What really made it click was the linked comment on the github issue (1).

Replicating here - to figure out your server’s capabilities, you can do (in the vim commandline):

lua =vim.lsp.get_active_clients()[1].name

to figure out which language server you’re trying to check, then

lua =vim.lsp.get_active_clients()[1].server_capabilities

to list its capabilities. The field names now reflect the language server protocol, so they are named things like hoverProvider. Find the field you would like to disable for your provider, then it its setup pass a custom on_attach function (e.g. my config for pylsp that disables its formatting, hover, and renaming):

    enable = true,
    -- disable several capabilities in favor of pyright
    on_attach = function (client, buffer)
        client.server_capabilities.documentFormattingProvider = false
        client.server_capabilities.hoverProvider = false
        client.server_capabilities.renameProvider = false
    settings = {
        pylsp = {
            configurationSources = { "flake8", "mypy" },
            plugins = {
                flake8 = { enabled = true },
                mypy = { enabled = true },


  1. resolved_capabilities is deprecated, update your plugins or configuration to access client.server_capabilities i nstead.The new key/value pairs in server_capabilities directly match those defined in the language server protocol · Issue #1891 · neovim/nvim-lspconfig · GitHub
  2. Automatically choose one language server to format code when using multiple language servers - #2 by mjlbach

Another related github issue: [Help] Disable single capabilities for a given LSP server · Issue #960 · neovim/nvim-lspconfig · GitHub

and the current wiki page:

1 Like