fix(vscode-typescript): activate for content-mapped-only workspaces - #64365
Closed
snehasish (snhsish) wants to merge 2 commits into
Closed
snehasish (snhsish) wants to merge 2 commits into
snehasish (snhsish) wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The protocol documentation is inconsistent with the new behavior, and the mapped-only synchronization regression lacks integration coverage.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Enables TypeScript 7 for workspaces containing only configured content-mapped files.
Changes:
- Activates on TypeScript/JavaScript config files.
- Synchronizes open non-JS/TS candidate documents.
- Adds candidate-filtering unit tests.
| File | Description |
|---|---|
packages/vscode-typescript/package.json |
Adds configuration-based activation events. |
packages/vscode-typescript/src/session.ts |
Synchronizes candidate mapped documents. |
packages/vscode-typescript/src/contentMapperContributions.ts |
Adds candidate detection and language modes. |
packages/vscode-typescript/src/util.ts |
Re-exports shared language modes. |
packages/vscode-typescript/test/contentMapperContributions.test.ts |
Tests candidate filtering. |
Comment on lines
151
to
+152
| const openDocuments = vscode.workspace.textDocuments | ||
| .filter(document => documentMatchesContentMapperContributions(document, this.contentMapperRegistrations)) | ||
| .filter(document => this.shouldSyncForDocument(document)) |
Comment on lines
+34
to
+38
| test("content mapper candidates are non-js/ts file and untitled documents", () => { | ||
| assert.equal(documentIsContentMapperCandidate({ uri: { scheme: "file" }, languageId: "plaintext" }), true); | ||
| assert.equal(documentIsContentMapperCandidate({ uri: { scheme: "file" }, languageId: "unknown" }), true); | ||
| assert.equal(documentIsContentMapperCandidate({ uri: { scheme: "untitled" }, languageId: "plaintext" }), true); | ||
| }); |
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The activation and synchronization changes are cohesive and covered by focused unit and end-to-end tests.
Review effort: Balanced
Findings: 2
Open (2)
Files not reviewed (1)
- tsc/internal/lsp/lsproto/lsp_generated.go: Generated file
Jake Bailey (jakebailey)
requested a review
from Andrew Branch (andrewbranch)
September 21, 2026 19:11
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.

Fixes #64355
Analysis
The TypeScript 7 VS Code extension only declares
onLanguageactivation events forjavascript/typescriptmodes, so opening a workspace containing only content-mapped files (e.g..tsrxwithcontentMappersintsconfig.json) never activates the extension and no language server starts.Activation alone is not sufficient (per the issue discussion): the server only registers mapper file extensions with the client after the project declaring
contentMappershas loaded, and that project only loads when one of its own files is opened. The extension'scustom/setContentMapperContributionssync filteredopenDocumentsdown to files matching API-registered (registerContentMappers) extensions, so tsconfig-declared mapped files were never reported, the configured project never loaded, and already-open mapped buffers stayed unserved — including projects that contain only mapped files.Fix
packages/vscode-typescript/package.json: also activate onworkspaceContains:**/tsconfig.jsonandworkspaceContains:**/jsconfig.jsonso mapped-only workspaces start the extension. (onStartupFinishedwas deliberately avoided to keep activation scoped.)packages/vscode-typescript/src/session.ts: report already-open non-JS/TSfile:/untitled:documents as candidate mapped files in theopenDocumentshint (singleshouldSyncForDocumentpredicate used by bothonDidOpenand the post-start sync, gated onjs/ts.contentMappers.enabled). This loads the declaring configured project, after which the server's dynamic registration delivers sync/diagnostics to the open buffers.packages/vscode-typescript/src/contentMapperContributions.ts: new puredocumentIsContentMapperCandidatepredicate;jsTsLanguageModesnow lives here (re-exported fromutil.ts) so the unit-test bundle stays free of the extension-hostvscoderuntime import.packages/vscode-typescript/test/contentMapperContributions.test.ts: covers candidate inclusion/exclusion.With
useTsgooff the extension still early-returns as before, and existing JS/TS activation paths are unchanged. #64356 is not included.Copilot Checklist
I successfully ran the applicable command at the end of my session, and it completed without error:
AI disclosure: this patch was authored with AI assistance and reviewed by the operator, who will shepherd it through review.