diff --git a/.changeset/netail-highlight-subscription.md b/.changeset/netail-highlight-subscription.md new file mode 100644 index 00000000000..fca7768684a --- /dev/null +++ b/.changeset/netail-highlight-subscription.md @@ -0,0 +1,5 @@ +--- +'vscode-graphql-syntax': patch +--- + +Add syntax highlighting support for subscription operations. diff --git a/packages/vscode-graphql-syntax/grammars/graphql.json b/packages/vscode-graphql-syntax/grammars/graphql.json index 3790a9dee49..f88f5672a34 100644 --- a/packages/vscode-graphql-syntax/grammars/graphql.json +++ b/packages/vscode-graphql-syntax/grammars/graphql.json @@ -22,7 +22,7 @@ }, "graphql-operation-def": { "patterns": [ - { "include": "#graphql-query-mutation" }, + { "include": "#graphql-query-mutation-subscription" }, { "include": "#graphql-name" }, { "include": "#graphql-variable-definitions" }, { "include": "#graphql-directive" }, @@ -55,8 +55,8 @@ { "include": "#literal-quasi-embedded" } ] }, - "graphql-query-mutation": { - "match": "\\s*\\b(query|mutation)\\b", + "graphql-query-mutation-subscription": { + "match": "\\s*\\b(query|mutation|subscription)\\b", "captures": { "1": { "name": "keyword.operation.graphql" } } diff --git a/packages/vscode-graphql-syntax/tests/__snapshots__/graphql-grammar.spec.ts.snap b/packages/vscode-graphql-syntax/tests/__snapshots__/graphql-grammar.spec.ts.snap index 8bf9ac2bea9..c70bb28ed78 100644 --- a/packages/vscode-graphql-syntax/tests/__snapshots__/graphql-grammar.spec.ts.snap +++ b/packages/vscode-graphql-syntax/tests/__snapshots__/graphql-grammar.spec.ts.snap @@ -200,7 +200,7 @@ newString | meta.selectionse ) | meta.selectionset.graphql meta.arguments.graphql meta.brace.round.directive.graphql } | meta.selectionset.graphql punctuation.operation.graphql | -subscription | entity.name.function.graphql +subscription | keyword.operation.graphql | subscriptionName | entity.name.function.graphql | meta.selectionset.graphql