Ensure LSPs Exit, Add Exit Activities #2080
Merged
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.
Description
LSPs may refuse to exit (due to a bug or whatnot) but we need to ensure that CodeEdit can still close when quit. This adds both a timeout when language servers are stopped, and a method to send
SIGKILLto language servers if necessary.This can only cause a delay while quitting CodeEdit. To help with the UX here, I've added some activity notifications that tell the user why we're delaying quitting CodeEdit. Both task termination and language server stopping are displayed while CodeEdit attempts to quit.
Detailed Changes
LanguageClientpackage to use a new method that lets us grab the started language server process.pid_tof the process is stored onLanguageServerfor future use.LSPService.stopServerto not use a throwing task group. For some reason the task group refused to continue even if the language server did close correctly. A non-throwing task group works correctly.LSPService.killAllServersto sendSIGKILLto all language servers if necessary.AppDelegateto send activity notifications when delaying quitting the app.AppDelegateto timeout language server stopping and kill them if necessary.TaskNotificationHandlerto help with sending tasks. Updated docs to match.TaskNotificationHandlerto limit activities to a single workspace. If left out, does not limit the workspace.CEActiveTaskto differentiate between task runs (see screen recording).Related Issues
Checklist
Screenshots
Before change. Tasks show up in all workspaces, cancelled tasks remove new task activities.
Screen.Recording.2025-07-08.at.11.58.24.AM.mov
After the change. Active tasks have their own ID and cancelled tasks don't remove new task activities.
Screen.Recording.2025-07-08.at.11.57.09.AM.mov