Skip to content
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

fix: specify buffer manually #445

Closed
wants to merge 3 commits into from
Closed

Conversation

IlyasYOY
Copy link

@IlyasYOY IlyasYOY commented Mar 25, 2024

in my case this line fixes: #434

previously we tried to call codelense for current buffer using gopls instance for different ones. This happened cause fresh gopls is started for external dependencies.

Here I used https://neovim.io/doc/user/lsp.html#vim.lsp.get_clients() to get LSP for a specific buffer.

previous solution worked only in nightly version
@IlyasYOY
Copy link
Author

I changed the code to stable API: c9504cd

Previous method was absent in 0.9: https://github.com/ray-x/go.nvim/actions/runs/8423800179/job/23066264136#step:7:109

@@ -53,7 +53,7 @@ function M.refresh()
if _GO_NVIM_CFG.lsp_codelens == true then
local found = false
if not found then
for _, lsp in pairs(vim.lsp.get_active_clients()) do
for _, lsp in pairs(vim.lsp.buf_get_clients(0)) do
Copy link
Owner

@ray-x ray-x Mar 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buf_get_clients is deprecated since nvim 0.9.x
You can add a filter to get_active_clients

get_active_clients({filter})                    *vim.lsp.get_active_clients()*
    Get active clients.

    Parameters:  
      • {filter}  (table|nil) A table with key-value pairs used to filter the
                  returned clients. The available keys are:
                  • id (number): Only return clients with the given id
                  • bufnr (number): Only return clients attached to this
                    buffer
                  • name (string): Only return clients with the given name

@IlyasYOY IlyasYOY closed this Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Telescope lsp_definitions clashing with go.nvim first time it's called
2 participants