microsoft / microsoft/TypeScript
tsserver plugin receives old proxy on configuration change
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔎 Search Terms
tsserver plugin old proxy
🕗 Version & Regression Information
Happens on 4.4.3, 5.2.2 and 5.3.0-dev.20230930 at least.
⏯ Playground Link
No response
💻 Code
Using this https://github.com/vemoo/TypeScript-TSServer-Plugin-Template
npm ci
tsc -p .
cd example
npm ci
code .
Open index.ts, ensure you are using typescript from workspace, "Command Palette..." > "TypeScript: Select TypeScript Version..." > "Use Workspace Version".
"Command Palette..." > "TypeScript: Open TS Server log" (enable it if prompted)
Go back to index.ts and trigger completions at any point. Search log file for my-plugin: getCompletionsAtPosition, a line like this will appear:
Info 151 [12:18:49.536] my-plugin: getCompletionsAtPosition ({"init":1,"create":1})
In the example folder in a terminal run touch tsconfig.json, go back to index.ts and trigger completions. Open log and search for my-plugin: getCompletionsAtPosition again. New lines appear:
Info 244 [12:22:23.378] my-plugin: getCompletionsAtPosition ({"init":2,"create":2})
Info 245 [12:22:23.378] my-plugin: getCompletionsAtPosition ({"init":1,"create":1})
🙁 Actual behavior
When tsconfig.json changes, the plugins init and create are called again but the info.languageService passed here https://github.com/vemoo/TypeScript-TSServer-Plugin-Template/blob/7ef3052284f644c9d15a048f43dcffc07c072936/src/index.ts#L7 is the one the plugin returned on the previous execution, so the language service returned by the plugin ends up doubly decorated.
🙂 Expected behavior
When plugin's create is called, info.languageService should contain an fresh object that doesn't have the decorations from the previous execution.
Additional information about the issue
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、tsconfig.json に変更を加えた後、TypeScript-TSServer-Plugin-Template を使って動作を再現し、src/index.ts と plugin init および create 周辺の tsserver ログを追跡します。tsserver プラグインのライフサイクルを追跡し、以前の language service が再び渡される理由を特定します。create が新しい未装飾の language service を受け取り、補完の繰り返し動作が適切なテストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100