typescript-basics: fix highlighting for triple-slash reference directives with preserve="true"
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 58/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- tooling
調査の方向性
extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.jsonから始め、特にissueで説明されているrepository/directivesパターンを確認してください。extensions/typescript-basics/test/colorize-fixtures/にある既存のcolorize fixtureを確認し、preserve="true"の有無にかかわらず、path、types、libディレクティブが引き続き正しくハイライトされることを検証してください。
索引モデルが issue の本文から書いたものです。
説明
Does this issue occur when all extensions are disabled?: Yes
- versions
Version: 1.108.2
Commit: c9d77990917f3102ada88be140d28b038d1dd7c7
Date: 2026-01-21T13:52:09.270Z
Electron: 39.2.7
ElectronBuildId: 12953945
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.19045
Problem
TypeScript supports preserve="true" on triple-slash reference directives, e.g.
/// <reference path="../communication-api.d.ts" preserve="true" />
However, VS Code's bundled TypeScript TextMate grammar fails to recognize the directive when preserve="true" is present, causing the line to be tokenized as a regular line comment instead of a reference directive.
Expected behavior
/// <reference ... /> should be tokenized/highlighted as a reference directive regardless of the presence of preserve="true".
Actual behavior
When preserve="true" is present, the entire line is highlighted as a regular line comment (directive tokenization does not apply).
Repro
- Open a
.tsfile in VS Code - Add the following baseline line (this is highlighted as a reference directive):
/// <reference path="../communication-api.d.ts" />
- Now add
preserve="true"(this becomes a regular comment highlight):
/// <reference path="../communication-api.d.ts" preserve="true" />
- Observe that only the
preserve="true"form loses directive highlighting.
Evidence (Inspect Editor Tokens and Scopes)
Without preserve="true"
- textmate scopes:
- punctuation.definition.comment.ts
- comment.line.triple-slash.directive.ts
- source.ts
- comment.line
With preserve="true"
- textmate scopes:
- comment.line.double-slash.ts
- source.ts
- comment.line
Potential fix
Update extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json under repository/directives to allow the optional preserve="true" attribute in /// <reference ... /> directives.
This makes directives with preserve="true" highlight consistently with the existing path/types/lib reference directives.
Notes
- The change is limited to the directive-matching pattern and does not affect general comment tokenization.
- Handles common spacing variants (e.g.
preserve="true"/>andpreserve="true" />).
Tests
-
Manual verification in VS Code:
/// <reference path="..." />(unchanged)/// <reference path="..." preserve="true" />(now highlighted as directive)- Same for
typesandlibforms
-
(Optional) Add/adjust a colorize fixture under
extensions/typescript-basics/test/colorize-fixtures/to cover thepreserve="true"case.
- 主要言語
- TypeScript
- スター
- 471
- フォーク
- 149
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/TypeScript-TmLanguage のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/TypeScript-TmLanguage#1071 ·
-
triste オープン
難易度 5/5 1週間以上 初心者へのやさしさ 5/100
microsoft/TypeScript-TmLanguage#1078 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
microsoft/TypeScript-TmLanguage#1076 · コメント 6 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
microsoft/TypeScript-TmLanguage#1074 · コメント 2 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
microsoft/TypeScript-TmLanguage#1064 ·
microsoft/TypeScript-TmLanguage の issue をすべて見る
似ている issue
-
comp/desktop P3 type/bug
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
NousResearch/hermes-agent#118866 ·
-
Browser Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
getsentry/sentry-javascript#24577 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
agilepathway/label-checker#640 ·
-
Plugin stuck at "loading" on DSH 0.1.6-alpha.2 — turnTail list slot registration missing options.id オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chrisparsons83/flexspotff#153 ·