[audit] replace deprecated vim.lsp.stop_client() with client:stop()#144
Merged
Conversation
vim.lsp.stop_client(id) is deprecated in Neovim 0.12; the new API is the client:stop() method directly on the client object. Removes the TODO comment that tracked this work. https://claude.ai/code/session_014eiycWG5KeoanDfLHDC825
Owner
Author
|
make it backward compatible i have v11 nvim on some of my machines and v12 on others, so make both api available @claude |
|
Claude finished @stanfish06's task in 55s —— View job Backward compatibility for
|
Use vim.fn.has('nvim-0.12') to branch between client:stop() (0.12+)
and vim.lsp.stop_client(client.id) (0.11 and below).
Co-authored-by: Zhiyuan <stanfish06@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
lua/config/plugin_config.lua— theLspTogglecommand — calls the deprecatedvim.lsp.stop_client(client.id). The code already has a-- TODOcomment flagging this.Where
lua/config/plugin_config.lualines 121–124:Why it matters
vim.lsp.stop_client()was deprecated in Neovim 0.12 in favour of callingstop()directly on the client object. Keeping the old form will emit deprecation warnings on every:LspToggleinvocation once Neovim completes the transition.Change
for _, client in ipairs(vim.lsp.get_clients({ bufnr = 0, name = name })) do - -- TODO: replace with Client:stop() after current api deprecate - vim.lsp.stop_client(client.id) + client:stop() return endDrops the resolved TODO comment as well.
Generated by Claude Code