Skip to content

fix(lsp): close timer when client exits#36795

Merged
zeertzjq merged 1 commit intoneovim:masterfrom
zeertzjq:lsp-client-stop
Dec 2, 2025
Merged

fix(lsp): close timer when client exits#36795
zeertzjq merged 1 commit intoneovim:masterfrom
zeertzjq:lsp-client-stop

Conversation

@zeertzjq
Copy link
Member

@zeertzjq zeertzjq commented Dec 2, 2025

Also, don't start the timer at all when a previous shutdown failed, as
in this case a forced shutdown is used and no timer is needed.

This fixes most of the delays caused by #36750.
The delays caused by #36378 still seem to remain.

Also, don't start the timer at all when a previous shutdown failed, as
in this case a forced shutdown is used and no timer is needed.

This fixes most of the delays caused by neovim#36750.
The delays caused by neovim#36378 still seem to remain.
@mfussenegger
Copy link
Member

Just fyi: #36783 and discussion in #36752 (comment) is somewhat related. Imho we should change the default back to false.

--- @field _otf_enabled boolean?
---
--- Timer for stop() with timeout.
--- @field private _shutdown_timer uv.uv_timer_t?
Copy link
Member

@justinmk justinmk Dec 2, 2025

Choose a reason for hiding this comment

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

name it _exit_timer for consistency with _on_exit / _on_exit_cbs / exit_timeout ?

(_graceful_shutdown_failed should perhaps also be renamed)

Copy link
Member Author

@zeertzjq zeertzjq Dec 2, 2025

Choose a reason for hiding this comment

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

Yes, but

  1. shutdown matches the name of the LSP request used when stopping the server.
  2. I think shutdown and exit are two different things. shutdown is a client action that affects the server, while exit is a server action.

Copy link
Member

Choose a reason for hiding this comment

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

It does, but in our layer we refer to "exit" and "stop". It's true that we send a "shutdown" to the server, but that is somewhat of an implementation detail.

Some of it overlaps, so it's somewhat messy. But at least the specific case of this timer is tracking "stop" and/or "exit". Could name this _stop_timer too. Mostly, it's useful to use a common prefix so all of these related things are grouped.

Copy link
Member

@justinmk justinmk left a comment

Choose a reason for hiding this comment

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

The naming nit is not a blocker

@zeertzjq zeertzjq merged commit a702534 into neovim:master Dec 2, 2025
59 of 60 checks passed
@zeertzjq zeertzjq deleted the lsp-client-stop branch December 2, 2025 23:44
yochem pushed a commit to yochem/neovim that referenced this pull request Dec 15, 2025
Also, don't start the timer at all when a previous shutdown failed, as
in this case a forced shutdown is used and no timer is needed.

This fixes most of the delays caused by neovim#36750.
The delays caused by neovim#36378 still seem to remain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants