Allow other VS Code extensions to install LSP middleware on language feature responses - #64583
Open
Andrew Branch (andrewbranch) wants to merge 7 commits into
Conversation
Copilot started reviewing on behalf of
Andrew Branch (andrewbranch)
October 1, 2026 23:34
View session
| @@ -0,0 +1,31 @@ | |||
| import fs from "node:fs"; | |||
There was a problem hiding this comment.
Perhaps time we just move LSP gen all the way up to the main scripts dir
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation is internally consistent, fault-isolated, and covered by focused runtime and generation tests.
Review effort: Balanced
Findings: None
What changed in this PR
Adds a public unstable VS Code extension API for transforming supported LSP language-feature responses.
Changes:
- Implements restart-safe middleware registration, chaining, cancellation, disposal, and error recovery.
- Generates strongly typed middleware protocol definitions from the shared LSP model.
- Adds comprehensive runtime, protocol, public-type, and generation tests.
| File | Description |
|---|---|
tsc/internal/lsp/lsproto/_generate/typeScript.mts |
Generates reachable TypeScript LSP types. |
tsc/internal/lsp/lsproto/_generate/generateTypeScript.mts |
Drives protocol type generation. |
tsc/internal/lsp/lsproto/_generate/generate.mts |
Exposes an isolated wire-model snapshot. |
tools/scripts/gen/lspTypeScript.test.mts |
Tests protocol generation and parsing. |
tools/scripts/gen/generatedFile.test.mts |
Verifies both generated LSP outputs remain current. |
packages/vscode-typescript/tsconfig.json |
Resolves the shared extension API source. |
packages/vscode-typescript/test/tsconfig.json |
Scopes extension test compilation. |
packages/vscode-typescript/test/lspMiddleware.test.ts |
Tests middleware behavior and public types. |
packages/vscode-typescript/test/index.test.ts |
Registers the middleware test suite. |
packages/vscode-typescript/src/session.ts |
Owns middleware across server restarts. |
packages/vscode-typescript/src/lspMiddleware.ts |
Implements middleware registration and execution. |
packages/vscode-typescript/src/extension.ts |
Exposes middleware registration publicly. |
packages/vscode-typescript/src/contentMapperContributions.ts |
Uses shared extension API types. |
packages/vscode-typescript/src/client.ts |
Routes requests through the registry. |
packages/vscode-typescript/package.json |
Adds the local API package dependency. |
packages/typescript/src/vscode/protocol.generated.ts |
Provides generated middleware protocol types. |
packages/typescript/src/vscode/extensionApi.ts |
Defines the unstable extension API. |
packages/typescript/package.json |
Exports the new type-only API path. |
package-lock.json |
Records the workspace dependency. |
Herebyfile.mjs |
Integrates protocol type generation. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
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.
Closes #63800
The second commit moves types for our VS Code extension API into the typescript package, generating a big chunk of the language server protocol, since middleware registration exposes it.
Example usage: