Skip to content

Commit

Permalink
Ensure highlighting works with typescript type parameters
Browse files Browse the repository at this point in the history
At least a partial fix for #2356, enables highlighting for typescript type parameters

Also casually bump the version for vscode-graphql once since 0.4.9 is released already from my local, so 0.4.10 becomes the next resolution we want.
  • Loading branch information
acao committed Jun 4, 2022
1 parent 1818982 commit 70bc61e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/sharp-bags-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'vscode-graphql': patch
---

Fix bug with typed parameters on the gql/graphql/etc tagged templates!
4 changes: 4 additions & 0 deletions packages/vscode-graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ const myQuery =

- the output channel occasionally shows "definition not found" when you first start the language service, but once the definition cache is built for each project, definition lookup will work. so if a "peek definition" fails when you first start the editor or when you first install the extension, just try the definition lookup again.

## Attribution

Thanks to apollo for their [graphql-vscode grammars](https://github.com/apollographql/vscode-graphql/blob/main/syntaxes/graphql.js.json)! We have borrowed from these on several occasions. If you are looking for the most replete set of vscode grammars for writing your own extension, look no further!

## Development

This plugin uses the [GraphQL language server](https://github.com/graphql/graphql-language-service-server)
Expand Down
25 changes: 25 additions & 0 deletions packages/vscode-graphql/grammars/graphql.js.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,31 @@
},
"patterns": [{ "include": "source.graphql" }]
},
{
"contentName": "meta.embedded.block.graphql",
"begin": "\\s*+(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental))\\s*(?:<.*>)(`)",
"beginCaptures": {
"1": {
"name": "variable.other.class.js"
},
"2": {
"name": "entity.name.function.tagged-template.js"
},
"3": {
"name": "entity.name.function.tagged-template.js"
},
"4": {
"name": "punctuation.definition.string.template.begin.js"
}
},
"end": "`",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.template.end.js"
}
},
"patterns": [{ "include": "source.graphql" }]
},
{
"name": "taggedTemplates",
"contentName": "meta.embedded.block.graphql",
Expand Down
3 changes: 1 addition & 2 deletions packages/vscode-graphql/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "vscode-graphql",
"version": "0.4.8",
"version": "0.4.9",
"preview": true,
"private": true,
"license": "MIT",
"displayName": "GraphQL",
"keywords": [
"multi-root ready",
"graphql",
"lsp",
"graph"
Expand Down

0 comments on commit 70bc61e

Please sign in to comment.