microsoft / microsoft/TypeScript
tsserver plugin receives old proxy on configuration change
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔎 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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il comportamento con TypeScript-TSServer-Plugin-Template, seguendo src/index.ts e il log di tsserver intorno a plugin init e create dopo aver modificato tsconfig.json. Traccia il ciclo di vita del plugin tsserver per determinare perché il language service precedente viene passato di nuovo. Il lavoro è completato quando create riceve un language service nuovo e non decorato e il comportamento di completamento ripetuto è coperto da un test appropriato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100