microsoft / microsoft/TypeScript
Semantic highlighting: Non-explicit readonly properties not shown as such
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔎 Search Terms
readonly, readonly properties
🕗 Version & Regression Information
Nothing to put in here, has never worked, I don't think.
Might be a language server issue, idk
⏯ Playground Link
💻 Code
In this example, there are 4 variables, all with a readonly property called abcdef, only the first one is registered by the IDE as being readonly, even though they are.
declare const a: {
readonly abcdef: number
}
a.abcdef
declare const b: Readonly<{
abcdef: number
}>
b.abcdef
declare const c: { readonly abcdef: true } | { readonly abcdef: false }
c.abcdef
if (c.abcdef) {
c.abcdef
}
class D {
get abcdef() {
return 1
}
}
declare const d: D
d.abcdef
🙁 Actual behavior
This is an IDE issue regarding code highlighting. When a property is readonly, but not explicitly so, it doesn't show up as a readonly property. TypeScript knows it's readonly, but the syntax highlighting doesn't always match it, which can be a bit confusing, just like if consts didn't always have the different highlighting. It's a lot nicer when you can always immediatly tell when something is readony, not by having to test it out and it makes it a lot more readable.
🙂 Expected behavior
All the properties should be registered as readonly, in the case of VSCode, the same colour as constants
Additional information about the issue
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた TypeScript Playground の例を使用してセマンティックハイライトの動作を再現し、対応する VSCode のハイライトを調査してください。Readonly、ユニオン、getter を含む4つの readonly プロパティのケースを比較し、すべての readonly プロパティが期待どおり一貫してハイライトされれば issue は完了とみなします。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100