graphql / vscode-graphql

MIGRATED: VSCode GraphQL extension (autocompletion, go-to definition, syntax highlighting)
https://marketplace.visualstudio.com/items?itemName=Prisma.vscode-graphql
MIT License
557 stars 71 forks source link

Allow custom pattern instead of just `gql` #294

Closed aspirisen closed 2 years ago

aspirisen commented 3 years ago

Actual Behavior

The autocomplete feature is tight to gql or graphql tags. It would be good to have some complex patterns like start with gql(' and with ') so you can create custom logic, but have autocomplete.

Also, it would be good to allow autocomplete even in TS types, i.e. start with Query<' and with '>. The syntax highlight works with #graphql comment even in types, but unfortunately it doesn't provide autocomplete.

Expected Behavior

Allow specifying custom patterns for matching

Specifications

acao commented 3 years ago

This already works for custom Language Server implementations. Thus why other editor extensions using our server sometimes support other tags

However, we can't support this dynamically for highlighting in vscode. That is all specified statically in the grammar/ json files for each language. In order to support this with highlighting in vscode, we would need to rewrite a significant part of the language server, for dynamic highlighting.

If you want to open a PR to support a new template tag for highlighting, feel free!

Hopefully someone will come along and give the language server some love!

arcanis commented 3 years ago

@acao I opened a PR at https://github.com/graphql/graphiql/pull/1941 to fix this, but the extension will need to be updated with a fresh dependency (once the PR is merged)

Restraint commented 3 years ago

Any chance we can get this bumped now that the above pr has been merged?

acao commented 2 years ago

it has been updated and vscode-graphql has been released! thanks @arcanis