microsoft / microsoft/TypeScript
tsserver plugin receives old proxy on configuration change
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.3k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
🔎 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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza reproduciendo el comportamiento con TypeScript-TSServer-Plugin-Template, siguiendo src/index.ts y el registro de tsserver alrededor de plugin init y create después de modificar tsconfig.json. Rastrea el ciclo de vida del plugin de tsserver para determinar por qué se vuelve a pasar el language service anterior. Se considera terminado cuando create recibe un language service nuevo y sin decorar, y el comportamiento de completado repetido queda cubierto por una prueba adecuada.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100