Skip to content

Conversation

@superatomic
Copy link
Contributor

Reintroduces behavior added in #2294. See #4136 for discussion.

Differences from the old implementation:

  • Uses :LspStop! instead of :LspStop ++force. If this is an undesirable change, I can implement it the original way.
  • Supports the same behavior for :LspRestart.

@justinmk
Copy link
Member

enable(false) already calls :stop(): https://github.com/neovim/neovim/blob/b67eff38fe19876ab228007897224ec04b58aa40/runtime/lua/vim/lsp.lua#L590-L591

oh, but I see this PR adds a true arg to "force" it.

but you can already get "force" behavior by calling LspStop twice?

--- By default, it will just request the server to shutdown without force. If
--- you request to stop a client which has previously been requested to
--- shutdown, it will automatically escalate and force shutdown.

If that's not good enough, I suggest sending a PR to Nvim core (and we can backport it to Nvim 0.11) which will automatically "escalate" after X seconds, similar to what we already do on Nvim exit.

@superatomic
Copy link
Contributor Author

It is true that you can call LspStop twice to achieve this force behavior. The issue is that some servers require being forced-stopped, and having to run :LspStop twice every single time in these instances can be annoying.

I'll take a look at adding escalation behavior to neovim core.

return client.name
end)
:totable()
clients = vim.lsp.get_clients()
Copy link
Member

Choose a reason for hiding this comment

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

good idea 👍

@justinmk
Copy link
Member

The code here is actually a nice improvement, and the bang variant is quite reasonable. So let's merge this.

I'll take a look at adding escalation behavior to neovim core.

That will be appreciated, it's the standard pattern that all such "teardown"/"stop" features should follow.

@justinmk justinmk merged commit 0d90bb9 into neovim:master Oct 23, 2025
6 checks passed
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