Closed ganemone closed 5 years ago
Thanks for the PR @ganemone
Can you confirm that this does what the PR intends it to do? To the best of my understanding, we support gql
tags by augmenting the TS language service with a plugin.
The docs of how to write such a plugin exist here: https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin
Concretely, our implementation of the plugin is here: https://github.com/divyenduz/ts-graphql-plugin
And this is where we use the plugin in this extension: https://github.com/prisma/vscode-graphql/blob/master/package.json#L113
We shouldn't have to add js
for watcher/document selector. But I would love to know your reasoning for this PR. If this is needed at all, this would also be required for .ts
files I think?
@divyenduz the typescript server approach won't work for projects that use flow and disable the builtin typescript language features. To be honest, as far as I can tell the typescript language server approach doesn't work at all, even with typescript features enabled.
I'm happy to expand this PR to replace the ts plugin so the completion support works the same way for both ts and non ts users. I think all the issues I linked in this PR are people who can corroborate that the autocomplete currently does not work.
Thanks, I understand, this PR is relatively safe to merge, so I will do that and release it. But I think that JS/TS auto completion should work in gql
tag anyways.
There are several reasons (mainly around developer experience) that in my understanding cause the above listed issues:
graphql-config
: This extension relies on the existence of that file to kick in. Generally, feel free to open issues and tag me to push things forward wrt this project. I am really happy that you raised this PR :)
This is released in 0.2.1
, thanks for your work on this 🙌
A lot of work is happening in the language service arena, they are moving it to a mono repo with GraphiQL, so, I anticipate good things for this plugin in future :)
This enables the graphql language server extension when in javascript files which will enable autocomplete when using tagged templates. This combined with https://github.com/graphql/graphiql/pull/883 will fix autocomplete with the gql tagged template.
Fixes #61 Fixes #21 Fixes #53 Fixes #96