Skip to content

Conversation

@thecoolwinter
Copy link
Collaborator

@thecoolwinter thecoolwinter commented Jul 8, 2025

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 SIGKILL to 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

  • Updated the LanguageClient package to use a new method that lets us grab the started language server process.
    • The pid_t of the process is stored on LanguageServer for future use.
  • Updated LSPService.stopServer to 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.
  • Added LSPService.killAllServers to send SIGKILL to all language servers if necessary.
  • Updated AppDelegate to send activity notifications when delaying quitting the app.
  • Updated AppDelegate to timeout language server stopping and kill them if necessary.
  • Added a little helper to TaskNotificationHandler to help with sending tasks. Updated docs to match.
  • Added a new parameter to TaskNotificationHandler to limit activities to a single workspace. If left out, does not limit the workspace.
    • Because of the new workspace parameter, I quickly limited tasks to only notify their workspaces.
    • I also added a second ID to CEActiveTask to differentiate between task runs (see screen recording).

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

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

@thecoolwinter thecoolwinter merged commit 334357f into CodeEditApp:main Jul 11, 2025
4 of 6 checks passed
@thecoolwinter thecoolwinter deleted the fix/lsp-timeout branch July 11, 2025 17:18
thecoolwinter added a commit that referenced this pull request Jul 16, 2025
### Description

- Adds two key commands - Command R and Command . to start and stop tasks.
- Adds a new Tasks menu item. Subitems:
  - Run {Selected Task}
    - Runs the selected task, disabled when no selected task.
  - Stop {Selected Task}
    - Stops the selected task, disabled when no task is running.
  - Show {Selected Task} Output
    - Navigates to the selected task output - this could maybe? be in the Navigate menu. *Looking for feedback here.*
  - Chose Task...
    - Submenu is a list of the user's tasks. Selects a task. If the user has no tasks, has a single "Create Task" item.
  - Manage Tasks
    - Opens the workspace's task settings.

### Related Issues

* Thought there was an open issue but there isn't, whoops.

### Checklist

- [x] I read and understood the [contributing guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md) as well as the [code of conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code

### Screenshots

Demo with running a task, stopping it, navigating to it's output.

> Note that there's a few bugs in this demo that are fixed by #2080. Such as overlapping task status and task activities appearing in all workspaces.

https://github.com/user-attachments/assets/602dedf2-3626-4ea1-a04b-9d7a9945a458
@thecoolwinter thecoolwinter added the bug Something isn't working label Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant