Skip to content

fix: stopped server would just restart#5051

Merged
benfdking merged 1 commit intomainfrom
working_on_fixing_stop
Jul 28, 2025
Merged

fix: stopped server would just restart#5051
benfdking merged 1 commit intomainfrom
working_on_fixing_stop

Conversation

@benfdking
Copy link
Contributor

  • 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
@benfdking benfdking requested a review from Copilot July 28, 2025 19:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 explicitlyStopped flag 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
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@benfdking benfdking merged commit 683a373 into main Jul 28, 2025
27 checks passed
@benfdking benfdking deleted the working_on_fixing_stop branch July 28, 2025 19:52
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