ldelossa / litee-calltree.nvim

Neovim's missing call hierarchy UI
131 stars 9 forks source link

codec -32601 #16

Open paopaol opened 2 years ago

paopaol commented 2 years ago

when i type tab, i got below error

微信截图_20220527104850

my neovim version is 0.8

ldelossa commented 2 years ago

That's your LSP responding with an error, I dont believe thats calltrees error

guangxu-li commented 2 years ago

I'm facing the exact same issue. Also only triggered when I try to expand.

Neovim: 0.8

guangxu-li commented 2 years ago

I'm facing the exact same issue. Also only triggered when I try to expand.

Neovim: 0.8

  • Use this plugin ray-x/navigator.lua to start lsp server gopls won't have this problem.
  • But start lsp server with lspconfig, the error comes back.

Solved by keeping only one lsp server.

After tracing the code, the problem is caused by this LSP request function in expand_calltree function

function M.expand_calltree()
   ...

   lib_lsp.multi_client_request(
        ctx.state["calltree"].active_lsp_clients,
        direction_map[ctx.state["calltree"].direction].method,
        {item = ctx.node.call_hierarchy_item},
        handlers.calltree_expand_handler(ctx.node, ctx.cursor, ctx.state["calltree"].direction, ctx.state),
        ctx.state["calltree"].buf
    )
    vim.api.nvim_win_set_cursor(ctx.state["calltree"].win, ctx.cursor)
end

In my use cases, if I enable golangci-lint-ls and gopls lsp server at the same time, the request to golangci-lint-ls will obviously fail to handle the request and it triggers the error msg in the screenshot.

After removing the golangci_lint_ls setup in lspconfig, the problem is resolved.

local servers = {
        ...
    -- 'golangci_lint_ls',
    'gopls',
        ...
}

for _, lsp in ipairs(servers) do
    local opts = {
        on_attach = on_attach,
        capabilities = capabilities,
        flags = {
            -- This will be the default in neovim 0.7+
            debounce_text_changes = 150,
        }
    }

    local custom_opts_file = "user.lsp.server-settings." .. lsp
    local ok, custom_opts = pcall(require, custom_opts_file)
    if ok then
        opts = vim.tbl_deep_extend("force", custom_opts, opts)
    end

    lspconfig[lsp].setup(opts)
end
entropitor commented 1 year ago

Any progress on this? It seems https://github.com/ldelossa/litee.nvim/issues/100 seems like the solution but it's a bit annoying that the plugin doesn't work in case of also having a lint LSP server that doesn't support this method.

entropitor commented 1 year ago

I think the problem is that https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp.lua#L48 doesn't list the incomingCalls and outgoingCalls method but only the prepareCallHierarchy method

entropitor commented 1 year ago

I have a PR up for the neovim side: https://github.com/neovim/neovim/pull/22427