Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider force restarting the server for very long running VS Code instances #1781

Closed
vinistock opened this issue Oct 20, 2023 · 3 comments
Closed
Labels
enhancement New feature or request help-wanted Extra attention is needed pinned This issue or pull request is pinned and won't be marked as stale transferred This issue was transferred from vscode-ruby-lsp

Comments

@vinistock
Copy link
Member

Some users never close or restart VS Code unless they absolutely have to. This means that - unless they modify a watched file like Gemfile.lock - they will never trigger the custom bundle logic and never try to update the server.

It would be great if we could detect that the VS Code window is idle, silently shutdown the server and then re-initialize it once there's activity again. Not sure if VS Code provides any APIs for this.

@vinistock vinistock added enhancement New feature or request help-wanted Extra attention is needed pinned This issue or pull request is pinned and won't be marked as stale labels Oct 20, 2023
@st0012
Copy link
Member

st0012 commented Oct 20, 2023

Do we have data showing how many users this could be benefiting, and how much degraded experience the problem is causing?

While I understand it's to help users get a better experience, the extra infra we need to add and maintain is concerning. We'll need to add this on both extension and the server, find ways to test them, and risking further-complicating the activation logic. So I'd avoid solving this unless we can easily justify it.

@vinistock
Copy link
Member Author

I agree that we need to understand how big of an issue this is - especially because the idle detection could lead to weird scenarios.

But I don't understand what you mean by extra infra and why the server would be involved. We could just listen for changes and consider that to be an idle indicator, which would clear a timer set to stop the server.

Something like this

// Automatically start the server when it became idle 
vscode.workspace.onDidChangeTextDocument((_event) => {
  if (this.client.state === State.Idle) {
    this.client?.start();
  }

  clearTimeout(this.idleTimer);
});

async start() {
  this.idleTimer = setTimeout(() => {
    await this.client.stop();
    this.client.state = State.Idle;
  }, ONE_HOUR);
}

@st0012 st0012 transferred this issue from Shopify/vscode-ruby-lsp Mar 18, 2024
@st0012 st0012 added the transferred This issue was transferred from vscode-ruby-lsp label Mar 18, 2024
@vinistock
Copy link
Member Author

I'm going to close this issue for now as it doesn't seem like we'll be exploring it any time soon.

@vinistock vinistock closed this as not planned Won't fix, can't repro, duplicate, stale Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help-wanted Extra attention is needed pinned This issue or pull request is pinned and won't be marked as stale transferred This issue was transferred from vscode-ruby-lsp
Projects
None yet
Development

No branches or pull requests

2 participants