Skip to content

Conversation

@jakebailey
Copy link
Member

@jakebailey jakebailey commented Aug 15, 2025

  • Set the LSP stderr to t.Output(), which means tests will actually get logging.
  • Pass a context into the LSP server to control its lifetime.
  • Ensure we wait for the LS to close in tests, and log errors before the test fully exits.

I moved the main context all the way up to main, since eventually we'll plumb it downward to the other commands. The movement means the LSP tests are not watching signals (which was an oops and caused weirdness).

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 improves the testing infrastructure for the LSP server and fourslash tests by enhancing lifecycle management and logging capabilities. The changes focus on proper context handling, test cleanup, and error reporting.

Key changes:

  • Added context-based lifecycle management to the LSP server
  • Improved test logging by directing LSP stderr to test output
  • Enhanced test cleanup with proper LSP server shutdown and error handling

Reviewed Changes

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

File Description
internal/lsp/server.go Modified Run method to accept context parameter and removed signal handling
internal/fourslash/fourslash.go Added context management, improved error handling, and redirected LSP stderr to test output
cmd/tsgo/main.go Added signal context creation at main entry point
cmd/tsgo/lsp.go Updated runLSP to accept and pass context to server

@jakebailey

This comment was marked as outdated.

@jakebailey jakebailey marked this pull request as draft August 15, 2025 17:17
@jakebailey
Copy link
Member Author

No, I just caused a race. Will figure it out.

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.

3 participants