fix: stopped server would just restart#5051
Merged
Conversation
Contributor
benfdking
commented
Jul 28, 2025
- stopped server would just restart if something needed it
- this adds explicit flag which indicates that it was stopped by a user
- stopped server would just restart if something needed it - this adds explicit flag which indicates that it was stopped by a user
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where a stopped LSP server would automatically restart when something needed it, by adding an explicit flag to track when the server was stopped by user action.
- Adds an
explicitlyStoppedflag to prevent automatic restarts after user-initiated stops - Updates LSP client methods to accept parameters indicating user-initiated actions
- Adds comprehensive test coverage for the new behavior
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| vscode/extension/src/lsp/lsp.ts | Adds explicitlyStopped flag and modifies start/restart/stop methods to respect user-initiated stops |
| vscode/extension/src/extension.ts | Updates restart function to pass user invocation flag to LSP client methods |
| vscode/extension/src/commands/stop.ts | Modifies stop command to indicate it was stopped by user |
| vscode/extension/tests/stop.spec.ts | Adds comprehensive test and removes unnecessary wait selector from existing test |
Comments suppressed due to low confidence (2)
vscode/extension/src/lsp/lsp.ts:65
- [nitpick] The parameter name 'overrideStoppedByUser' is ambiguous. Consider renaming to 'forceStart' or 'ignoreUserStop' to better indicate its purpose of bypassing the explicitly stopped flag.
overrideStoppedByUser = false,
vscode/extension/src/lsp/lsp.ts:143
- [nitpick] The parameter name 'overrideByUser' is inconsistent with 'overrideStoppedByUser' in the start method and doesn't clearly convey its purpose. Consider using a consistent name like 'userInitiated' or 'invokedByUser' across both methods.
overrideByUser = false,
| * by the user. This is used to prevent the client from being restarted unless the user | ||
| * explicitly calls the `restart` method. | ||
| */ | ||
| private explicitlyStopped = false |
There was a problem hiding this comment.
The explicitlyStopped flag is never reset to false after being set to true. This means once a user stops the server, it can never be automatically started again until the extension is reloaded. Consider resetting this flag when the user explicitly restarts the server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.