microsoft / microsoft/TypeScript
tsserver plugin receives old proxy on configuration change
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with the TypeScript-TSServer-Plugin-Template, following src/index.ts and the tsserver log around plugin init and create after touching tsconfig.json. Trace the tsserver plugin lifecycle to determine why the previous language service is passed again. Done means create receives a fresh, undecorated language service and the repeated-completion behavior is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100