Quramy / ts-graphql-plugin

TypeScript Language Service Plugin for GraphQL developers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ensure compatibility with Typescript integrated in vscode

ntziolis opened this issue · comments

Right now the plugin does not work when used without installing as a dev dependency and referencing the tsserver to use the local version.

I have already excluded version conflicts by testing:

Does work:

  • 2.5.3 (dev dependency)

Does not work:

  • 2.5.3 (vscode build in) no intellisene in gql tags

No changes were made to project or package.json in the meanwhile. You can easily repro it by downloading your project and remove the workspace setting.

Since this doesn't seem to be a version issue, any idea why this breaks?

🤔 It seems that VSC bundled TypeScript can't resolve locally installed plugins. I think it's not this plugin's issue but VSC bundled TypeScript's module resolution issue...

BTW, I recommend to install typescript into your project as devDependency.

@Quramy After running into this same issue and modifying vscode to use local TS installation (2.5.3) I'm getting the plugin to load successfully on the tsserver logs (and parsing the graphql schema file). However, I'm seeing no errors in vscode when I introduce typos in the gql query (also no autocompletion or anything). Any hints what I should look for? Something in the tsserver logs?

@inakianduaga after configuring a local TS version you need to tell vcsode to actually use it. Open command bar in vscode and execute TypeScript: Restart TS Server and choose your work space version when it asks you to choose.

Note: I'm still not getting errors in TS Server log but i do get autocompletion in gql tags after pressing ctrl+space.. That said its well worth the setup hassle first time as it speeds up development significantly especially when combined with auto generating models + access code for those queries

Install ts localy and swith vscode to it works for me. Big thanks for comments!!