Skip to content

Conversation

@Atan-D-RP4
Copy link

@Atan-D-RP4 Atan-D-RP4 commented Oct 24, 2025

Problem:
0d90bb9 broke Lsp[Stop/Restart] due accessing vim.lsp.config with potentially nil/invalid name with vim.lsp.config[name] in the case of #clients == 0 being false.

Fix:
Just added an else clause that makes the clients variable a vim.lsp.Clients[] instead list/table of str's.

fix #4153

Problem:
0d90bb9 broke Lsp[Stop/Restart]  due accessing vim.lsp.config with potentially nil/invalid name with vim.lsp.config[name] in the case of #clients == 0 being false.

Fix:
Just added an `else` clause that makes the clients variable a vim.lsp.Clients[] instead list/table of str's.
@Atan-D-RP4 Atan-D-RP4 closed this by deleting the head repository Oct 24, 2025
@justinmk
Copy link
Member

@superatomic do you see a way to address this without 20 lines of new code ?

@superatomic
Copy link
Contributor

superatomic commented Oct 24, 2025

Oops! I completely forgot to test the modified commands with arguments. Sorry for breaking master.

@superatomic do you see a way to address this without 20 lines of new code ?

There's one way to do this: revert most of the changes I made in #4140, but replace client:stop(true) with vim.iter(vim.lsp.get_clients({ name = name })):each(function(client) client:stop(true) end). This allows for stopping a client by name, instead of changing the code to require a client. I can open a PR with these changes if you would prefer that to this current one.

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.

Passing arguments to LspRestart causes it to fail

3 participants