visual-studio-codevscode-extensionslanguageservice

VSCode TypeScript Plugin and workspaces API


I am writing a TypeScript language plugin for GraphQL and I need to access the project root at some places. I want to use the workspaces API to make this workspace ready.

I tried including vscode directly and that doesn't work

Is it possible to pass information like this from extension to language plugin or is there a way to access workspace API in language plugin?


Solution

  • This is not possible. TypeScript server plugins run in a separate process from normal VS Code extensions and cannot access the normal VS code api.

    This feature request would add a basic channel so that VS Code extensions to communicate with TS server plugins.

    The other option that could work today is to open a communications pipe from your plugin to a vscode extension.