Fix trigger-character completion race in LSP proxy#122
Open
bro4all wants to merge 2 commits intomodular:mainfrom
Open
Fix trigger-character completion race in LSP proxy#122bro4all wants to merge 2 commits intomodular:mainfrom
bro4all wants to merge 2 commits intomodular:mainfrom
Conversation
BEGIN_PUBLIC [Mojo] Serialize LSP proxy packet writes Auto-triggered completion could race with didChange because the proxy wrote outgoing LSP packets independently. Serialize proxy writes through a single queue and register pending requests before sending request packets so completion requests no longer overtake earlier document-change notifications. Add regression coverage for the proxy write ordering and a completion test that exercises trigger-character completion after typing '.' in a Mojo file. END_PUBLIC
BEGIN_PUBLIC [Mojo] Fix lint for proxy regression tests Address the GitHub lint failures in the new proxy regression tests by documenting the compiled proxy require in the TypeScript test and declaring the Node globals used by the fake LSP server helper. END_PUBLIC Signed-off-by: Omar Habra <omarbro4all@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Typing
.in a Mojo file could triggertextDocument/completionat the same time as the precedingtextDocument/didChangenotification. The proxy wrote those packets independently, so the completion request could overtake the change and the server replied with-32600: invalid request.Fix
Serialize all outgoing proxy packets through a single write queue in
MojoLSPServer, and register pending requests before writing the request packet. That keepsdidChangeand later requests in order and closes the fast-response race.Tests
.in a Mojo file.npm run ci,npm run typecheck,npm run build,npm run format, and the default VS Code test suite.