Skip to content

tsserver plugin receives old proxy on configuration changeΒ #55928

Open
@vemoo

Description

@vemoo

πŸ”Ž 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsThe issue relates to how you learn TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions