TypeScript 7 VS Code extension never activates for workspaces where only content-mapped files are opened

Ouverte
#64,355 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
68/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
typescript, vscode

Piste de recherche

Start with packages/vscode-typescript/package.json and its activationEvents, then reproduce the workspace containing only a content-mapped file with js/ts.experimental.useTsgo and js/ts.contentMappers.enabled enabled. Compare the available activation strategies in the issue and verify that the extension activates and provides TypeScript 7 language features without opening a separate .ts or .js file.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

🔎 Search Terms
  • vscode-typescript activationEvents content mapper contentMappers
  • TypeScript 7 extension does not activate
  • onLanguage:typescript native-preview
🕗 Version & Regression Information
  • The TypeScript 7 VS Code extension built from packages/vscode-typescript at f29aeb9 (main, 2026-09-16), running 7.1.0-dev.20260918.1 (@typescript/typescript-darwin-x64), VS Code 1.138.0, macOS 26.6 x64
  • Same activationEvents in the published TypeScriptTeam.native-preview 0.20260708.2 and in current main, so not a regression
⏯ Playground Link

n/a (VS Code extension behaviour)

💻 Code

packages/vscode-typescript/package.json declares only

"activationEvents": [
  "onLanguage:javascript",
  "onLanguage:javascriptreact",
  "onLanguage:typescript",
  "onLanguage:typescriptreact"
]

A workspace whose tsconfig.json declares a content mapper for another extension:

{
  "contentMappers": [{ "package": "@tsrx/content-mapper", "extensions": [".tsrx"] }],
  "include": ["*.ts", "*.tsrx"]
}

Steps, with js/ts.experimental.useTsgo: true and js/ts.contentMappers.enabled: true:

  1. Open the workspace and open a .tsrx file (or any file of a content-mapped language).
  2. Observe: the extension is not activated (vscode.extensions.getExtension("TypeScriptTeam.native-preview").isActive === false), no language server starts, the file gets no diagnostics, hover or completions from TypeScript 7.
  3. Open any .ts or .js file in the same window: the extension activates, the server starts, and the .tsrx file is served correctly from then on (its tsconfig mapper is picked up, diagnostics and hover appear).
🙁 Actual behavior

A workspace where the user only opens content-mapped files never gets TypeScript 7 features, with no indication why. From the user's point of view the mapped language's tooling looks broken; opening an unrelated .ts file "fixes" it.

🙂 Expected behavior

The extension should also activate when it may have work to do for content-mapped files, for example:

  • workspaceContains:**/tsconfig.json (or **/jsconfig.json), or
  • onStartupFinished when js/ts.experimental.useTsgo is on (it already reads the setting on activation and returns early when it is off), or
  • an activation hook for extensions that declare a content mapper.
Additional information about the issue

Found while wiring the TSRX VS Code extension to TypeScript 7 content mappers (tsrx-org/tsrx#135). The built-in TypeScript extension does not have this gap in practice because VS Code activates it on other events as well (onLanguage:jsonc among them), so on TypeScript 5/6 the same workspace works.

Langage dominant
Go
Étoiles
111k
Forks
14.4k
Merge moyen
1 j 19 h
PR mergées (30 j)
117

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoft/TypeScript

Toutes les issues de microsoft/TypeScript

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.