pmizio / typescript-tools.nvim

⚡ TypeScript integration NeoVim deserves ⚡
MIT License
1.45k stars 40 forks source link

Code lens is working but getting errors that it is not supported by server #274

Closed augustocdias closed 3 months ago

augustocdias commented 4 months ago

I'm getting errors saying that none of the registered servers support code lenses but I'm getting them fine in my code.

image

I have the following autocmd set up in the on_attach function

if client.server_capabilities.code_lens or client.server_capabilities.codeLensProvider then
            local group = augroup('LSPRefreshLens')

            -- Code Lens
            autocmd({ 'BufEnter', 'InsertLeave' }, {
                desc = 'Auto show code lenses',
                buffer = bufnr,
                callback = function()
                    vim.lsp.codelens.refresh({ bufnr = bufnr })
                end,
                group = group,
            })
        end

I've debugged the table from the client table and the codeLensProvider is indeed set and advertising support, so I don't understand why I'm seeing this error.

augustocdias commented 4 months ago

Deleting the buffer and reopening seems to make the issue go away... It is weird though that the first time the buffer is attached and the server starts this happens.

antoinegomez commented 3 months ago

I have the same problem, also with vtsls and same for lua-ls, so it is not related to this project.

Other people impacted: https://www.reddit.com/r/neovim/comments/1cygzip/upgraded_to_010_but_getting_lsp_codelens_issues/