Skip to content

Conversation

@jakebailey
Copy link
Member

This makes the fourslash runner into an actual async LSP client, removing the hacks we have to make the init cycle work. There are now goroutines similar to what we do inside the LSP server itself, which manage the calls back and forth, fetching info, etc.

This involved restructuring things a bit, along with fixes to ensure that we never attempt to use t on the wrong goroutine, as well as eliminating t.Cleanup, which mistakenly closed over t to run stuff, which shouldn't really work.

This leads to a large diff due to the fourslash tests updating, but it's sort of unavoidable.

This also lets us disable the push diag hack in fourslash tests. We ignore the notification (and, don't really have a way to wait for them), but that's okay for now.

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 converts the fourslash test runner into a proper async LSP client by introducing goroutines to manage bidirectional communication with the LSP server. The main changes include:

  • Implementing async message routing with goroutines for server/client communication
  • Adding proper response handling via channels instead of synchronous message reading
  • Removing the hack that disabled push diagnostics
  • Updating the initialization sequence to properly wait for configuration exchanges

Reviewed changes

Copilot reviewed 300 out of 2817 changed files in this pull request and generated no comments.

File Description
internal/fourslash/fourslash.go Core async refactoring: adds message router goroutine, response channel handling, server request handling, and removes synchronous readMsg method
internal/fourslash/_scripts/convertFourslash.mts Updates test generator to use new NewFourslash signature returning cleanup function
internal/fourslash/tests/gen/*.go Updates all generated tests to use new API with defer done() pattern
internal/fourslash/tests/*.go Updates hand-written tests to use new API with defer done() pattern

@jakebailey jakebailey added this pull request to the merge queue Dec 3, 2025
Merged via the queue into main with commit 7c40d35 Dec 3, 2025
22 checks passed
@jakebailey jakebailey deleted the jabaile/lsp-fourslash-async branch December 3, 2025 15:59
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