Content mappers round 2 - #63936
Conversation
…tal file conflicts
There was a problem hiding this comment.
Pull request overview
Completes the second content-mapper integration round across compiler emit, span mapping, language services, protocol handling, and VS Code registration.
Changes:
- Emits declaration maps composed through content-mapper mappings.
- Adds multi-projection support for hover, formatting, folding, CodeLens, signature help, and navigation.
- Updates mapper contracts, extension matching, diagnostics, build watching, tests, and baselines.
Reviewed changes
Copilot reviewed 80 out of 83 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
tsc/testdata/tests/cases/compiler/contentMapperDeclarationEmitFailure.ts |
Tests declaration emit after mapper failure. |
tsc/testdata/tests/cases/compiler/contentMapperDeclarationEmit.ts |
Expands mapped declaration-map coverage. |
tsc/testdata/baselines/reference/fourslash/vsFindAllReferences/contentMapperDisabledNavigationTargets.baseline |
Baselines disabled VS references. |
tsc/testdata/baselines/reference/fourslash/state/codeLensAcrossProjects.baseline |
Records CodeLens virtual positions. |
tsc/testdata/baselines/reference/fourslash/quickInfo/contentMapperHoverConcatenatesProjections.baseline |
Baselines combined hover output. |
tsc/testdata/baselines/reference/fourslash/goToDefinition/contentMapperDisabledNavigationTargets.baseline.jsonc |
Baselines disabled definitions. |
tsc/testdata/baselines/reference/fourslash/goToDefinition/contentMapperDeclarationMapNavigation.baseline.jsonc |
Baselines declaration-map definitions. |
tsc/testdata/baselines/reference/fourslash/findAllReferences/contentMapperDisabledNavigationTargets.baseline.jsonc |
Baselines disabled references. |
tsc/testdata/baselines/reference/fourslash/findAllReferences/contentMapperDeclarationMapNavigation.baseline.jsonc |
Baselines mapped references. |
tsc/testdata/baselines/reference/fourslash/codeLenses/contentMapperSupplementalImplementationCodeLens.baseline.jsonc |
Baselines supplemental implementation lenses. |
tsc/testdata/baselines/reference/fourslash/codeLenses/contentMapperSupplementalCodeLens.baseline.jsonc |
Baselines supplemental reference lenses. |
tsc/testdata/baselines/reference/fourslash/codeLenses/contentMapperDisabledSupplementalCodeLens.baseline.jsonc |
Baselines disabled supplemental lenses. |
tsc/testdata/baselines/reference/fourslash/codeLenses/contentMapperDeduplicatesProjectedCodeLens.baseline.jsonc |
Baselines deduplicated lenses. |
tsc/testdata/baselines/reference/compiler/contentMapperSupplementalModule.errors.txt |
Uses original filenames in diagnostics. |
tsc/testdata/baselines/reference/compiler/contentMapperSupplementalDiagnostics.errors.txt |
Updates supplemental diagnostic filenames. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmitFailure.types |
Adds failed-map type baseline. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmitFailure.symbols |
Adds failed-map symbol baseline. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmitFailure.sourcemap.txt |
Adds empty declaration-map record. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmitFailure.js.map |
Adds failed-map output. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmitFailure.js |
Adds failed declaration output. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmitFailure.contentmapper |
Baselines mapper failure details. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmit.types |
Updates declaration types. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmit.symbols |
Updates declaration symbols. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmit.sourcemap.txt |
Baselines composed mappings. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmit.js.map |
Adds mapped declaration source map. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmit.js |
Updates declaration output. |
tsc/testdata/baselines/reference/compiler/contentMapperDeclarationEmit.contentmapper |
Updates transformed-content baseline. |
tsc/internal/tsoptions/tsconfigparsing.go |
Canonicalizes mapper extensions. |
tsc/internal/tsoptions/tsconfigparsing_test.go |
Tests extension casing rules. |
tsc/internal/testutil/tsbaseline/sourcemap_baseline.go |
Supports mapped declaration-map baselines. |
tsc/internal/testutil/tsbaseline/error_baseline.go |
Counts renamed supplemental diagnostics. |
tsc/internal/testutil/harnessutil/harnessutil.go |
Uses original text for map records. |
tsc/internal/testutil/contentmappertest/protocol.go |
Removes protocol-version fixtures. |
tsc/internal/testutil/contentmappertest/editing.go |
Adds supplemental feature fixtures. |
tsc/internal/testutil/contentmappertest/duplicate.go |
Adds hover/signature projections. |
tsc/internal/testutil/contentmappertest/component.go |
Anchors synthesized default exports. |
tsc/internal/spanmap/spanmap.go |
Supports overlaps and exact position mapping. |
tsc/internal/spanmap/spanmap_test.go |
Tests overlap and endpoint behavior. |
tsc/internal/sourcemap/generator.go |
Handles generated-only mapping precedence. |
tsc/internal/sourcemap/generator_test.go |
Tests same-position mapping precedence. |
tsc/internal/printer/printer.go |
Adds source-position composition hook. |
tsc/internal/outputpaths/outputpaths.go |
Allocates mapped declaration maps. |
tsc/internal/lsp/server.go |
Makes contributed extensions case-insensitive. |
tsc/internal/lsp/server_contentmapper_internal_test.go |
Tests contribution extension casing. |
tsc/internal/lsp/lsproto/lsp_generated.go |
Adds CodeLens projection metadata. |
tsc/internal/lsp/lsproto/_generate/generate.mts |
Generates new CodeLens fields. |
tsc/internal/ls/signaturehelp.go |
Tries multiple signature projections. |
tsc/internal/ls/rename.go |
Adapts cross-project invocation. |
tsc/internal/ls/lsconv/converters.go |
Converts original-document ranges. |
tsc/internal/ls/hover.go |
Combines hover projections. |
tsc/internal/ls/format.go |
Formats mapped verbatim ranges. |
tsc/internal/ls/folding.go |
Aggregates mapped folding ranges. |
tsc/internal/ls/findallreferences.go |
Applies feature-aware navigation mapping. |
tsc/internal/ls/definition.go |
Removes synthetic navigation fallbacks. |
tsc/internal/ls/crossproject.go |
Accepts precomputed symbol data. |
tsc/internal/ls/codelens.go |
Supports supplemental CodeLens resolution. |
tsc/internal/ls/callhierarchy.go |
Adapts cross-project invocation. |
tsc/internal/ls/autoimport/registry.go |
Excludes supplemental auto-import targets. |
tsc/internal/fourslash/tests/contentMapperSignatureHelp_test.go |
Tests signature projection fallback. |
tsc/internal/fourslash/tests/contentMapperHover_test.go |
Tests hover fallback and concatenation. |
tsc/internal/fourslash/tests/contentMapperEditSafety_test.go |
Tests folding, CodeLens, and formatting. |
tsc/internal/fourslash/tests/contentMapperDuplicateMappings_test.go |
Tests disabled navigation targets. |
tsc/internal/fourslash/tests/contentMapperDeclarationMapNavigation_test.go |
Tests declaration-map navigation. |
tsc/internal/fourslash/tests/contentMapperAutoImports_test.go |
Tests supplemental auto-import exclusion. |
tsc/internal/execute/tsctests/contentmapper_watch_test.go |
Tests diagnostics, collisions, and symlink watching. |
tsc/internal/execute/build/orchestrator.go |
Resolves watched mapper manifests. |
tsc/internal/execute/build/buildtask.go |
Detects physical supplemental-file conflicts. |
tsc/internal/diagnosticwriter/diagnosticwriter.go |
Presents canonical supplemental filenames. |
tsc/internal/diagnostics/extraDiagnosticMessages.json |
Removes obsolete diagnostics. |
tsc/internal/diagnostics/diagnostics_generated.go |
Regenerates diagnostic definitions. |
tsc/internal/contentmapper/hostimpl.go |
Revises mapper protocol contracts. |
tsc/internal/contentmapper/host.go |
Removes protocol-version errors. |
tsc/internal/contentmapper/host_test.go |
Updates host protocol tests. |
tsc/internal/compiler/fileloader.go |
Removes obsolete mapper diagnostics. |
tsc/internal/compiler/emitter.go |
Composes declaration source maps. |
packages/vscode-typescript/test/tsconfig.json |
Configures extension tests. |
packages/vscode-typescript/test/index.test.ts |
Aggregates extension tests. |
packages/vscode-typescript/test/contentMapperContributions.test.ts |
Tests contribution serialization and matching. |
packages/vscode-typescript/src/contentMapperContributions.ts |
Completes API rename and casing support. |
packages/vscode-typescript/package.json |
Builds and runs aggregated tests. |
packages/typescript/test/spanMap.test.ts |
Tests public span-map overlap behavior. |
packages/typescript/src/ast/spanMap.ts |
Mirrors overlapping span-map support. |
.github/skills/compiler-and-fourslash-tests/SKILL.md |
Documents content-mapper test expectations. |
Files not reviewed (1)
- tsc/internal/diagnostics/diagnostics_generated.go: Generated file
Suppressed comments (1)
tsc/internal/contentmapper/hostimpl.go:213
- This also does not make
diagnostics[].coderequired when decoding: a mapper can omit it and the Go JSON decoder supplies0, which is then emitted as the diagnostic code. Please validate field presence during response decoding rather than relying on the serialization tag.
Code int32 `json:"code"`
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| Path []json.Value `json:"path"` | ||
| MessageText string `json:"messageText"` | ||
| Code int32 `json:"code,omitempty"` | ||
| Code int32 `json:"code"` |
There was a problem hiding this comment.
Maybe controversial, but this was intentional. It didn't seem worth erroring over a missing code, but coalescing to 0 means it's visible when diagnostics are reported, so appears obvious as a mapper misconfiguration. It's more work and more code to validate and return a diagnostic.
| if mapper.PackageDirectory == "" || mapper.ContributionID != "" { | ||
| continue | ||
| } | ||
| if _, changed := changedPaths[w.sys.FS().Realpath(tspath.CombinePaths(mapper.PackageDirectory, "package.json"))]; changed { |
There was a problem hiding this comment.
I assume this is now fine because fswatch handles this?
There was a problem hiding this comment.
Ah, this was explained by #63936 (comment) — mapper.PackageDirectory is already a realpath.
This finishes out microsoft/typescript-go#4712 with some additional bug fixes and a couple missing features.
Protocol/Contract/API changes
protocolVersionfrominitializeparams and response: protocol changes will be handled with LSP-likecapabilitiesrather than specifying a version.codeis now required.inferredProjectContributionproperty, not aninferredProjectproperty. (Previously shipped with an incomplete rename.)SpanMapFeature.Definition.Features
Bug fixes
Several, see individual commits.