Skip to content

fix(ex.lsp.single): replace deprecated get_buffers_by_client_id - #40

Merged
vladimir-popov merged 2 commits into
dokwork:mainfrom
icalvo:fix/deprecated-lsp-attached-buffers
Jun 24, 2026
Merged

vladimir-popov merged 2 commits into
dokwork:mainfrom
icalvo:fix/deprecated-lsp-attached-buffers

Conversation

@icalvo

@icalvo icalvo commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace vim.lsp.get_buffers_by_client_id() with client.attached_buffers in ex.lsp.single
  • Update tests to set attached_buffers on mocked clients instead of stubbing the deprecated API

Fixes the Neovim 0.12 deprecation warning (removed in 0.13) shown when the statusline refreshes after LSP attach.

Test plan

  • make test only=components/lsp_spec.lua
  • Open a file with LSP attached and confirm no get_buffers_by_client_id warning in :checkhealth vim.deprecated

Made with Cursor

Use client.attached_buffers instead of vim.lsp.get_buffers_by_client_id(),
which is deprecated in Neovim 0.12 and removed in 0.13.

Co-authored-by: Cursor <cursoragent@cursor.com>
@icalvo

icalvo commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

It's doing fine on my local. Also I understand you may want backwards compat, but maybe you can open a branch for 0.13. Also I know it's AI and you can throw it to the bin for that reason, np!

@vladimir-popov

Copy link
Copy Markdown
Collaborator

@icalvo Thanks for the PR! AI-generated code is not a problem by itself. I only care about the final
result.

Right now the formatting check is failing, as well as the test
ex.lsp.single component on draw should not create highlight for the different client with the same name.
Please fix them.

I also do not see an obvious backward compatibility issue. The project targets
Neovim 0.10+, and client.attached_buffers is available there. Could you clarify what exactly you expect to break, and in which Neovim version or usage scenario?

@icalvo

icalvo commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

I didn't expect anything either way; I am just not knowledgeable enough about Neovim to know if the new API has been there long enough not to break any version you support.

@vladimir-popov
vladimir-popov merged commit 69b3cb7 into dokwork:main Jun 24, 2026
4 checks passed
@vladimir-popov

Copy link
Copy Markdown
Collaborator

@icalvo Good job! Thank you!

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.

2 participants