Minimal reporoduction repo to show differences in TS Server plugin handling in VSCode and Webstorm.
The writing of the plugin is based off this documentation: https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin.
This repo uses Yarn as its project manager. Everything is committed in the repo so no additional command needs to be run.
Open Settings > Languages & Frameworks > TypeScript and make sure TypeScript is loaded from ~/<path-to-your-project>/webstorm-minimal-tsserver-plugin/node_modules/typescript
Open Help > Diagnostic Tools > Debug Log Settings... and make sure it includes the line com.intellij.lang.javascript.service.JSLanguageServiceQueue:trace
Restart the TypeScript language service and hit "Reload from disk" on the repo root: the TypeScript debug log should appear at the root of the repo with the name .log<ID>
cmd + shift + P > TypesScript: Select TypeScript version... and make sure to select the workspace version
Open the TypeScript logs by doing cmd + shift + P > TypeScript: Open TS Server logs
Note: TypeScript logging may not be enabled, this command should offer to turn on logging if you don't have it enabled
The logs should somewhere around /Users/<user>/Library/Application Support/Code/logs/<id>/window3/exthost/vscode.typescript-language-features/tsserver-log-<log-id>/tsserver.log: you can see the exact path by opening the TypeScript output and checking for the path in the logs.
Add the custom suggestion myCustomFunction3 to the completions list with details like its source. Upon accepting the suggestion, the corresponding import should be added.
- Open
packages/my-package/main.ts - Place the cursor after
myCustomFunction(line 5) - Press
ctrl + spaceon both Webstorm and VSCode
In plugins/tsserver/src/index.js:
- Adding an entry to the completions list: function
getCompletionsAtPosition(lines 18 to 49) - Adding details to the custom entry: function
getCompletionEntryDetails(lines 52 to 124)
The details added in getCompletionEntryDetails seem to not be taken into account, especially the following fields:
displayPartsshowing the source of the functioncodeActionsdefining the import line to add when selecting the custom completions entry
Add the custom quick fix "Add dependency for 'myCustomFunction3'" to the list of quick fixes. Upon selecting the custom quick fix, the function applyCodeActionCommand should be triggered with the name installCustomPackage, showing a log in the TS Server log.
- Open
packages/my-package/main.ts - Place the cursor inside
"custom-package"(line 1) - Display the list of quick fixes:
- On VSCode: press
cmd + . - On Webstorm: press
opt + return
- On VSCode: press
In plugins/tsserver/src/index.js:
- Adding a custom quick fix for the TS error TS2307: function
getCodeFixesAtPosition(lines 155 to 176) - Applying the custom code action command: function
applyCodeActionCommand(lines 220 to 234)
The function applyCodeActionCommand seems to not be triggered on Webstorm, which prevents custom code action commands from being run.





