Skip to content

Ensure LSP server exits on stdin close #936

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

Merged
merged 1 commit into from
May 27, 2025
Merged

Ensure LSP server exits on stdin close #936

merged 1 commit into from
May 27, 2025

Conversation

jakebailey
Copy link
Member

Fixes #935

We want the server to exit when stdin closes, but the current code was returning nil, leaving the errgroup running, leaving the process behind.

Verified

This commit was signed with the committer’s verified signature.
weswigham Wesley Wigham
Copy link
Contributor

@Copilot 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 the LSP server would continue running in the background when stdin was closed by ensuring the server exits properly.

  • Updated the Run method in server.go to conditionally ignore io.EOF errors from the errgroup.
  • Simplified error handling in lsp.go by removing redundant io.EOF checks and cleaning up unused imports.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/lsp/server.go Modified Run to check for io.EOF and return nil for this error, ensuring proper shutdown.
cmd/tsgo/lsp.go Removed redundant error checks and imports, relying on the logic defined in Run.
Comments suppressed due to low confidence (1)

cmd/tsgo/lsp.go:50

  • [nitpick] The removal of the explicit io.EOF check and unused imports simplifies error handling; ensure that this change remains consistent with the intended shutdown behavior documented in the Run method.
if err := s.Run(); err != nil {

@DanielRosenwasser DanielRosenwasser changed the title Ensure LSP server exists on stdin close Ensure LSP server exits on stdin close May 25, 2025
@jakebailey jakebailey added this pull request to the merge queue May 27, 2025
Merged via the queue into main with commit f9431be May 27, 2025
23 checks passed
@jakebailey jakebailey deleted the jabaile/fix-exit branch May 27, 2025 16:27
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.

tsgo process remains running and consuming memory after they should have been killed
2 participants