From ba60804c103f1fb6f31cdbc589f87b610065ab29 Mon Sep 17 00:00:00 2001 From: Maikel van Dort Date: Mon, 29 Dec 2025 11:55:20 +0100 Subject: [PATCH 1/4] fix: missing subscription syntax highlight --- .../grammars/graphql.json | 1052 +++++++++++++---- 1 file changed, 790 insertions(+), 262 deletions(-) diff --git a/packages/vscode-graphql-syntax/grammars/graphql.json b/packages/vscode-graphql-syntax/grammars/graphql.json index 3790a9dee49..7fa3a67c330 100644 --- a/packages/vscode-graphql-syntax/grammars/graphql.json +++ b/packages/vscode-graphql-syntax/grammars/graphql.json @@ -1,32 +1,75 @@ { "name": "GraphQL", "scopeName": "source.graphql", - "fileTypes": ["graphql", "graphqls", "gql", "graphcool"], - "patterns": [{ "include": "#graphql" }], + "fileTypes": [ + "graphql", + "graphqls", + "gql", + "graphcool" + ], + "patterns": [ + { + "include": "#graphql" + } + ], "repository": { "graphql": { "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-fragment-definition" }, - { "include": "#graphql-directive-definition" }, - { "include": "#graphql-type-interface" }, - { "include": "#graphql-enum" }, - { "include": "#graphql-scalar" }, - { "include": "#graphql-union" }, - { "include": "#graphql-schema" }, - { "include": "#graphql-operation-def" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-fragment-definition" + }, + { + "include": "#graphql-directive-definition" + }, + { + "include": "#graphql-type-interface" + }, + { + "include": "#graphql-enum" + }, + { + "include": "#graphql-scalar" + }, + { + "include": "#graphql-union" + }, + { + "include": "#graphql-schema" + }, + { + "include": "#graphql-operation-def" + }, + { + "include": "#literal-quasi-embedded" + } ] }, "graphql-operation-def": { "patterns": [ - { "include": "#graphql-query-mutation" }, - { "include": "#graphql-name" }, - { "include": "#graphql-variable-definitions" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-selection-set" } + { + "include": "#graphql-query-mutation" + }, + { + "include": "#graphql-name" + }, + { + "include": "#graphql-variable-definitions" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#graphql-selection-set" + } ] }, "graphql-fragment-definition": { @@ -34,31 +77,57 @@ "begin": "\\s*(?:(\\bfragment\\b)\\s*([_A-Za-z][_0-9A-Za-z]*)?)", "end": "(?<=})", "captures": { - "1": { "name": "keyword.fragment.graphql" }, - "2": { "name": "entity.name.fragment.graphql" } + "1": { + "name": "keyword.fragment.graphql" + }, + "2": { + "name": "entity.name.fragment.graphql" + } }, "patterns": [ { "match": "\\s*(?:(\\bon\\b)\\s*([_A-Za-z][_0-9A-Za-z]*))", "captures": { - "1": { "name": "keyword.on.graphql" }, - "2": { "name": "support.type.graphql" } + "1": { + "name": "keyword.on.graphql" + }, + "2": { + "name": "support.type.graphql" + } } }, - { "include": "#graphql-variable-definitions" }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-selection-set" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-skip-newlines" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-variable-definitions" + }, + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-selection-set" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#graphql-skip-newlines" + }, + { + "include": "#literal-quasi-embedded" + } ] }, "graphql-query-mutation": { - "match": "\\s*\\b(query|mutation)\\b", + "match": "\\s*\\b(query|subscription|mutation)\\b", "captures": { - "1": { "name": "keyword.operation.graphql" } + "1": { + "name": "keyword.operation.graphql" + } } }, "graphql-type-interface": { @@ -67,41 +136,81 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { "name": "keyword.type.graphql" }, - "2": { "name": "keyword.type.graphql" }, - "3": { "name": "keyword.interface.graphql" }, - "4": { "name": "keyword.input.graphql" }, - "5": { "name": "support.type.graphql" } + "1": { + "name": "keyword.type.graphql" + }, + "2": { + "name": "keyword.type.graphql" + }, + "3": { + "name": "keyword.interface.graphql" + }, + "4": { + "name": "keyword.input.graphql" + }, + "5": { + "name": "support.type.graphql" + } }, "patterns": [ { "begin": "\\s*\\b(implements)\\b\\s*", "end": "\\s*(?={)", "beginCaptures": { - "1": { "name": "keyword.implements.graphql" } + "1": { + "name": "keyword.implements.graphql" + } }, "patterns": [ { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "support.type.graphql" } + "1": { + "name": "support.type.graphql" + } } }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-ampersand" }, - { "include": "#graphql-comma" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#graphql-ampersand" + }, + { + "include": "#graphql-comma" + } ] }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-type-object" }, - { "include": "#literal-quasi-embedded" }, - { "include": "#graphql-ignore-spaces" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#graphql-type-object" + }, + { + "include": "#literal-quasi-embedded" + }, + { + "include": "#graphql-ignore-spaces" + } ] }, "graphql-ignore-spaces": { @@ -112,18 +221,34 @@ "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": { + "name": "punctuation.operation.graphql" + } }, "endCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": { + "name": "punctuation.operation.graphql" + } }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-object-type" }, - { "include": "#graphql-type-definition" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-object-type" + }, + { + "include": "#graphql-type-definition" + }, + { + "include": "#literal-quasi-embedded" + } ] }, "graphql-type-definition": { @@ -131,74 +256,136 @@ "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", "end": "(?=\\s*(([_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(})))|\\s*(,)", "beginCaptures": { - "1": { "name": "variable.graphql" } + "1": { + "name": "variable.graphql" + } }, "endCaptures": { - "5": { "name": "punctuation.comma.graphql" } + "5": { + "name": "punctuation.comma.graphql" + } }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-variable-definitions" }, - { "include": "#graphql-type-object" }, - { "include": "#graphql-colon" }, - { "include": "#graphql-input-types" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#graphql-variable-definitions" + }, + { + "include": "#graphql-type-object" + }, + { + "include": "#graphql-colon" + }, + { + "include": "#graphql-input-types" + }, + { + "include": "#literal-quasi-embedded" + } ] }, "graphql-schema": { "begin": "\\s*\\b(schema)\\b", "end": "(?<=})", "beginCaptures": { - "1": { "name": "keyword.schema.graphql" } + "1": { + "name": "keyword.schema.graphql" + } }, "patterns": [ { "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": { + "name": "punctuation.operation.graphql" + } }, "endCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": { + "name": "punctuation.operation.graphql" + } }, "patterns": [ { "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", "end": "(?=\\s*(([_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(})))|\\s*(,)", "beginCaptures": { - "1": { "name": "variable.arguments.graphql" } + "1": { + "name": "variable.arguments.graphql" + } }, "endCaptures": { - "5": { "name": "punctuation.comma.graphql" } + "5": { + "name": "punctuation.comma.graphql" + } }, "patterns": [ { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "support.type.graphql" } + "1": { + "name": "support.type.graphql" + } } }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-colon" }, - { "include": "#graphql-skip-newlines" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-colon" + }, + { + "include": "#graphql-skip-newlines" + } ] }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-skip-newlines" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-skip-newlines" + } ] }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-skip-newlines" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#graphql-skip-newlines" + } ] }, "graphql-comment": { @@ -248,14 +435,26 @@ "begin": "\\s*(\\()", "end": "\\s*(\\))", "captures": { - "1": { "name": "meta.brace.round.graphql" } + "1": { + "name": "meta.brace.round.graphql" + } }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-variable-definition" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-variable-definition" + }, + { + "include": "#literal-quasi-embedded" + } ] }, "graphql-variable-definition": { @@ -264,31 +463,59 @@ "begin": "\\s*(\\$?[_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", "end": "(?=\\s*((\\$?[_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(}|\\))))|\\s*(,)", "beginCaptures": { - "1": { "name": "variable.parameter.graphql" } + "1": { + "name": "variable.parameter.graphql" + } }, "endCaptures": { - "5": { "name": "punctuation.comma.graphql" } + "5": { + "name": "punctuation.comma.graphql" + } }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-colon" }, - { "include": "#graphql-input-types" }, - { "include": "#graphql-variable-assignment" }, - { "include": "#literal-quasi-embedded" }, - { "include": "#graphql-skip-newlines" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#graphql-colon" + }, + { + "include": "#graphql-input-types" + }, + { + "include": "#graphql-variable-assignment" + }, + { + "include": "#literal-quasi-embedded" + }, + { + "include": "#graphql-skip-newlines" + } ] }, "graphql-input-types": { "patterns": [ - { "include": "#graphql-scalar-type" }, + { + "include": "#graphql-scalar-type" + }, { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?:\\s*(!))?", "captures": { - "1": { "name": "support.type.graphql" }, - "2": { "name": "keyword.operator.nulltype.graphql" } + "1": { + "name": "support.type.graphql" + }, + "2": { + "name": "keyword.operator.nulltype.graphql" + } } }, { @@ -296,16 +523,32 @@ "begin": "\\s*(\\[)", "end": "\\s*(\\])(?:\\s*(!))?", "captures": { - "1": { "name": "meta.brace.square.graphql" }, - "2": { "name": "keyword.operator.nulltype.graphql" } + "1": { + "name": "meta.brace.square.graphql" + }, + "2": { + "name": "keyword.operator.nulltype.graphql" + } }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-input-types" }, - { "include": "#graphql-comma" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-input-types" + }, + { + "include": "#graphql-comma" + }, + { + "include": "#literal-quasi-embedded" + } ] } ] @@ -313,15 +556,23 @@ "graphql-scalar": { "match": "\\s*\\b(scalar)\\b\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "keyword.scalar.graphql" }, - "2": { "name": "entity.scalar.graphql" } + "1": { + "name": "keyword.scalar.graphql" + }, + "2": { + "name": "entity.scalar.graphql" + } } }, "graphql-scalar-type": { "match": "\\s*\\b(Int|Float|String|Boolean|ID)\\b(?:\\s*(!))?", "captures": { - "1": { "name": "support.type.builtin.graphql" }, - "2": { "name": "keyword.operator.nulltype.graphql" } + "1": { + "name": "support.type.builtin.graphql" + }, + "2": { + "name": "keyword.operator.nulltype.graphql" + } } }, "graphql-variable-assignment": { @@ -329,38 +580,54 @@ "end": "(?=[\n,)])", "applyEndPatternLast": 1, "beginCaptures": { - "1": { "name": "punctuation.assignment.graphql" } + "1": { + "name": "punctuation.assignment.graphql" + } }, - "patterns": [{ "include": "#graphql-value" }] + "patterns": [ + { + "include": "#graphql-value" + } + ] }, "graphql-comma": { "match": "\\s*(,)", "captures": { - "1": { "name": "punctuation.comma.graphql" } + "1": { + "name": "punctuation.comma.graphql" + } } }, "graphql-ampersand": { "match": "\\s*(&)", "captures": { - "1": { "name": "keyword.operator.logical.graphql" } + "1": { + "name": "keyword.operator.logical.graphql" + } } }, "graphql-colon": { "match": "\\s*(:)", "captures": { - "1": { "name": "punctuation.colon.graphql" } + "1": { + "name": "punctuation.colon.graphql" + } } }, "graphql-union-mark": { "match": "\\s*(\\|)", "captures": { - "1": { "name": "punctuation.union.graphql" } + "1": { + "name": "punctuation.union.graphql" + } } }, "graphql-name": { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "entity.name.function.graphql" } + "1": { + "name": "entity.name.function.graphql" + } } }, "graphql-directive": { @@ -368,15 +635,29 @@ "end": "(?=.)", "applyEndPatternLast": 1, "beginCaptures": { - "1": { "name": "entity.name.function.directive.graphql" } + "1": { + "name": "entity.name.function.directive.graphql" + } }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-arguments" }, - { "include": "#literal-quasi-embedded" }, - { "include": "#graphql-skip-newlines" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-arguments" + }, + { + "include": "#literal-quasi-embedded" + }, + { + "include": "#graphql-skip-newlines" + } ] }, "graphql-directive-definition": { @@ -455,21 +736,43 @@ "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": { + "name": "punctuation.operation.graphql" + } }, "endCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": { + "name": "punctuation.operation.graphql" + } }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-field" }, - { "include": "#graphql-fragment-spread" }, - { "include": "#graphql-inline-fragment" }, - { "include": "#graphql-comma" }, - { "include": "#native-interpolation" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-field" + }, + { + "include": "#graphql-fragment-spread" + }, + { + "include": "#graphql-inline-fragment" + }, + { + "include": "#graphql-comma" + }, + { + "include": "#native-interpolation" + }, + { + "include": "#literal-quasi-embedded" + } ] }, "graphql-field": { @@ -477,21 +780,37 @@ { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)\\s*(:)", "captures": { - "1": { "name": "string.unquoted.alias.graphql" }, - "2": { "name": "punctuation.colon.graphql" } + "1": { + "name": "string.unquoted.alias.graphql" + }, + "2": { + "name": "punctuation.colon.graphql" + } } }, { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "variable.graphql" } + "1": { + "name": "variable.graphql" + } } }, - { "include": "#graphql-arguments" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-selection-set" }, - { "include": "#literal-quasi-embedded" }, - { "include": "#graphql-skip-newlines" } + { + "include": "#graphql-arguments" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#graphql-selection-set" + }, + { + "include": "#literal-quasi-embedded" + }, + { + "include": "#graphql-skip-newlines" + } ] }, "graphql-fragment-spread": { @@ -499,18 +818,38 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { "name": "keyword.operator.spread.graphql" }, - "2": { "name": "variable.fragment.graphql" } + "1": { + "name": "keyword.operator.spread.graphql" + }, + "2": { + "name": "variable.fragment.graphql" + } }, "patterns": [ - { "include": "#graphql-arguments" }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-selection-set" }, - { "include": "#graphql-directive" }, - { "include": "#literal-quasi-embedded" }, - { "include": "#graphql-skip-newlines" } + { + "include": "#graphql-arguments" + }, + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-selection-set" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#literal-quasi-embedded" + }, + { + "include": "#graphql-skip-newlines" + } ] }, "graphql-inline-fragment": { @@ -518,18 +857,38 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { "name": "keyword.operator.spread.graphql" }, - "2": { "name": "keyword.on.graphql" }, - "3": { "name": "support.type.graphql" } + "1": { + "name": "keyword.operator.spread.graphql" + }, + "2": { + "name": "keyword.on.graphql" + }, + "3": { + "name": "support.type.graphql" + } }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-selection-set" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-skip-newlines" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-selection-set" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#graphql-skip-newlines" + }, + { + "include": "#literal-quasi-embedded" + } ] }, "graphql-arguments": { @@ -537,59 +896,97 @@ "begin": "\\s*(\\()", "end": "\\s*(\\))", "beginCaptures": { - "1": { "name": "meta.brace.round.directive.graphql" } + "1": { + "name": "meta.brace.round.directive.graphql" + } }, "endCaptures": { - "1": { "name": "meta.brace.round.directive.graphql" } + "1": { + "name": "meta.brace.round.directive.graphql" + } }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, { "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?:\\s*(:))", "end": "(?=\\s*(?:(?:([_A-Za-z][_0-9A-Za-z]*)\\s*(:))|\\)))|\\s*(,)", "beginCaptures": { - "1": { "name": "variable.parameter.graphql" }, - "2": { "name": "punctuation.colon.graphql" } + "1": { + "name": "variable.parameter.graphql" + }, + "2": { + "name": "punctuation.colon.graphql" + } }, "endCaptures": { - "3": { "name": "punctuation.comma.graphql" } + "3": { + "name": "punctuation.comma.graphql" + } }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-value" }, - { "include": "#graphql-skip-newlines" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#graphql-value" + }, + { + "include": "#graphql-skip-newlines" + } ] }, - { "include": "#literal-quasi-embedded" } + { + "include": "#literal-quasi-embedded" + } ] }, "graphql-variable-name": { "match": "\\s*(\\$[_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "variable.graphql" } + "1": { + "name": "variable.graphql" + } } }, "graphql-float-value": { "match": "\\s*(-?(0|[1-9][0-9]*)(\\.[0-9]+)?((e|E)(\\+|-)?[0-9]+)?)", "captures": { - "1": { "name": "constant.numeric.float.graphql" } + "1": { + "name": "constant.numeric.float.graphql" + } } }, "graphql-boolean-value": { "match": "\\s*\\b(true|false)\\b", "captures": { - "1": { "name": "constant.language.boolean.graphql" } + "1": { + "name": "constant.language.boolean.graphql" + } } }, "graphql-null-value": { "match": "\\s*\\b(null)\\b", "captures": { - "1": { "name": "constant.language.null.graphql" } + "1": { + "name": "constant.language.null.graphql" + } } }, "graphql-string-value": { @@ -597,17 +994,31 @@ "begin": "\\s*+((\"))", "end": "\\s*+(?:((\"))|(\n))", "beginCaptures": { - "1": { "name": "string.quoted.double.graphql" }, - "2": { "name": "punctuation.definition.string.begin.graphql" } + "1": { + "name": "string.quoted.double.graphql" + }, + "2": { + "name": "punctuation.definition.string.begin.graphql" + } }, "endCaptures": { - "1": { "name": "string.quoted.double.graphql" }, - "2": { "name": "punctuation.definition.string.end.graphql" }, - "3": { "name": "invalid.illegal.newline.graphql" } + "1": { + "name": "string.quoted.double.graphql" + }, + "2": { + "name": "punctuation.definition.string.end.graphql" + }, + "3": { + "name": "invalid.illegal.newline.graphql" + } }, "patterns": [ - { "include": "#graphql-string-content" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-string-content" + }, + { + "include": "#literal-quasi-embedded" + } ] }, "graphql-string-content": { @@ -627,8 +1038,12 @@ "begin": "\\s*+\\b(enum)\\b\\s*([_A-Za-z][_0-9A-Za-z]*)", "end": "(?<=})", "beginCaptures": { - "1": { "name": "keyword.enum.graphql" }, - "2": { "name": "support.type.enum.graphql" } + "1": { + "name": "keyword.enum.graphql" + }, + "2": { + "name": "support.type.enum.graphql" + } }, "patterns": [ { @@ -636,26 +1051,51 @@ "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": { + "name": "punctuation.operation.graphql" + } }, "endCaptures": { - "1": { "name": "punctuation.operation.graphql" } + "1": { + "name": "punctuation.operation.graphql" + } }, "patterns": [ - { "include": "#graphql-object-type" }, - - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" }, - { "include": "#graphql-enum-value" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-object-type" + }, + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-directive" + }, + { + "include": "#graphql-enum-value" + }, + { + "include": "#literal-quasi-embedded" + } ] }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-directive" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-directive" + } ] }, "graphql-enum-value": { @@ -664,17 +1104,39 @@ }, "graphql-value": { "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-variable-name" }, - { "include": "#graphql-float-value" }, - { "include": "#graphql-string-value" }, - { "include": "#graphql-boolean-value" }, - { "include": "#graphql-null-value" }, - { "include": "#graphql-enum-value" }, - { "include": "#graphql-list-value" }, - { "include": "#graphql-object-value" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-variable-name" + }, + { + "include": "#graphql-float-value" + }, + { + "include": "#graphql-string-value" + }, + { + "include": "#graphql-boolean-value" + }, + { + "include": "#graphql-null-value" + }, + { + "include": "#graphql-enum-value" + }, + { + "include": "#graphql-list-value" + }, + { + "include": "#graphql-object-value" + }, + { + "include": "#literal-quasi-embedded" + } ] }, "graphql-list-value": { @@ -684,12 +1146,20 @@ "begin": "\\s*+(\\[)", "end": "\\s*(\\])", "endCaptures": { - "1": { "name": "meta.brace.square.graphql" } + "1": { + "name": "meta.brace.square.graphql" + } }, "beginCaptures": { - "1": { "name": "meta.brace.square.graphql" } + "1": { + "name": "meta.brace.square.graphql" + } }, - "patterns": [{ "include": "#graphql-value" }] + "patterns": [ + { + "include": "#graphql-value" + } + ] } ] }, @@ -700,14 +1170,22 @@ "begin": "\\s*+({)", "end": "\\s*(})", "beginCaptures": { - "1": { "name": "meta.brace.curly.graphql" } + "1": { + "name": "meta.brace.curly.graphql" + } }, "endCaptures": { - "1": { "name": "meta.brace.curly.graphql" } + "1": { + "name": "meta.brace.curly.graphql" + } }, "patterns": [ - { "include": "#graphql-object-field" }, - { "include": "#graphql-value" } + { + "include": "#graphql-object-field" + }, + { + "include": "#graphql-value" + } ] } ] @@ -715,9 +1193,15 @@ "graphql-object-field": { "match": "\\s*(([_A-Za-z][_0-9A-Za-z]*))\\s*(:)", "captures": { - "1": { "name": "constant.object.key.graphql" }, - "2": { "name": "string.unquoted.graphql" }, - "3": { "name": "punctuation.graphql" } + "1": { + "name": "constant.object.key.graphql" + }, + "2": { + "name": "string.unquoted.graphql" + }, + "3": { + "name": "punctuation.graphql" + } } }, "graphql-union": { @@ -725,8 +1209,12 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { "name": "keyword.union.graphql" }, - "2": { "name": "support.type.graphql" } + "1": { + "name": "keyword.union.graphql" + }, + "2": { + "name": "support.type.graphql" + } }, "patterns": [ { @@ -734,29 +1222,57 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { "name": "punctuation.assignment.graphql" }, - "2": { "name": "support.type.graphql" } + "1": { + "name": "punctuation.assignment.graphql" + }, + "2": { + "name": "support.type.graphql" + } }, "patterns": [ - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-skip-newlines" }, - { "include": "#literal-quasi-embedded" }, + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-skip-newlines" + }, + { + "include": "#literal-quasi-embedded" + }, { "match": "\\s*(\\|)\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { "name": "punctuation.or.graphql" }, - "2": { "name": "support.type.graphql" } + "1": { + "name": "punctuation.or.graphql" + }, + "2": { + "name": "support.type.graphql" + } } } ] }, - { "include": "#graphql-comment" }, - { "include": "#graphql-description-docstring" }, - { "include": "#graphql-description-singleline" }, - { "include": "#graphql-skip-newlines" }, - { "include": "#literal-quasi-embedded" } + { + "include": "#graphql-comment" + }, + { + "include": "#graphql-description-docstring" + }, + { + "include": "#graphql-description-singleline" + }, + { + "include": "#graphql-skip-newlines" + }, + { + "include": "#literal-quasi-embedded" + } ] }, "native-interpolation": { @@ -764,16 +1280,28 @@ "begin": "\\s*(\\${)", "end": "(})", "beginCaptures": { - "1": { "name": "keyword.other.substitution.begin" } + "1": { + "name": "keyword.other.substitution.begin" + } }, "endCaptures": { - "1": { "name": "keyword.other.substitution.end" } + "1": { + "name": "keyword.other.substitution.end" + } }, "patterns": [ - { "include": "source.js" }, - { "include": "source.ts" }, - { "include": "source.js.jsx" }, - { "include": "source.tsx" } + { + "include": "source.js" + }, + { + "include": "source.ts" + }, + { + "include": "source.js.jsx" + }, + { + "include": "source.tsx" + } ] }, "graphql-skip-newlines": { From 0d431e112d421e15e8e288bb1d5df78f65d787c5 Mon Sep 17 00:00:00 2001 From: Maikel van Dort Date: Mon, 29 Dec 2025 12:02:14 +0100 Subject: [PATCH 2/4] changeset --- .changeset/netail-highlight-subscription.md | 5 + .../grammars/graphql.json | 1058 +++++------------ 2 files changed, 270 insertions(+), 793 deletions(-) create mode 100644 .changeset/netail-highlight-subscription.md 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 7fa3a67c330..d1ffb88de90 100644 --- a/packages/vscode-graphql-syntax/grammars/graphql.json +++ b/packages/vscode-graphql-syntax/grammars/graphql.json @@ -1,75 +1,32 @@ { "name": "GraphQL", "scopeName": "source.graphql", - "fileTypes": [ - "graphql", - "graphqls", - "gql", - "graphcool" - ], - "patterns": [ - { - "include": "#graphql" - } - ], + "fileTypes": ["graphql", "graphqls", "gql", "graphcool"], + "patterns": [{ "include": "#graphql" }], "repository": { "graphql": { "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-fragment-definition" - }, - { - "include": "#graphql-directive-definition" - }, - { - "include": "#graphql-type-interface" - }, - { - "include": "#graphql-enum" - }, - { - "include": "#graphql-scalar" - }, - { - "include": "#graphql-union" - }, - { - "include": "#graphql-schema" - }, - { - "include": "#graphql-operation-def" - }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-fragment-definition" }, + { "include": "#graphql-directive-definition" }, + { "include": "#graphql-type-interface" }, + { "include": "#graphql-enum" }, + { "include": "#graphql-scalar" }, + { "include": "#graphql-union" }, + { "include": "#graphql-schema" }, + { "include": "#graphql-operation-def" }, + { "include": "#literal-quasi-embedded" } ] }, "graphql-operation-def": { "patterns": [ - { - "include": "#graphql-query-mutation" - }, - { - "include": "#graphql-name" - }, - { - "include": "#graphql-variable-definitions" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#graphql-selection-set" - } + { "include": "#graphql-query-mutation" }, + { "include": "#graphql-name" }, + { "include": "#graphql-variable-definitions" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-selection-set" } ] }, "graphql-fragment-definition": { @@ -77,57 +34,31 @@ "begin": "\\s*(?:(\\bfragment\\b)\\s*([_A-Za-z][_0-9A-Za-z]*)?)", "end": "(?<=})", "captures": { - "1": { - "name": "keyword.fragment.graphql" - }, - "2": { - "name": "entity.name.fragment.graphql" - } + "1": { "name": "keyword.fragment.graphql" }, + "2": { "name": "entity.name.fragment.graphql" } }, "patterns": [ { "match": "\\s*(?:(\\bon\\b)\\s*([_A-Za-z][_0-9A-Za-z]*))", "captures": { - "1": { - "name": "keyword.on.graphql" - }, - "2": { - "name": "support.type.graphql" - } + "1": { "name": "keyword.on.graphql" }, + "2": { "name": "support.type.graphql" } } }, - { - "include": "#graphql-variable-definitions" - }, - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-selection-set" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#graphql-skip-newlines" - }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#graphql-variable-definitions" }, + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-selection-set" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-skip-newlines" }, + { "include": "#literal-quasi-embedded" } ] }, "graphql-query-mutation": { "match": "\\s*\\b(query|subscription|mutation)\\b", "captures": { - "1": { - "name": "keyword.operation.graphql" - } + "1": { "name": "keyword.operation.graphql" } } }, "graphql-type-interface": { @@ -136,81 +67,41 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { - "name": "keyword.type.graphql" - }, - "2": { - "name": "keyword.type.graphql" - }, - "3": { - "name": "keyword.interface.graphql" - }, - "4": { - "name": "keyword.input.graphql" - }, - "5": { - "name": "support.type.graphql" - } + "1": { "name": "keyword.type.graphql" }, + "2": { "name": "keyword.type.graphql" }, + "3": { "name": "keyword.interface.graphql" }, + "4": { "name": "keyword.input.graphql" }, + "5": { "name": "support.type.graphql" } }, "patterns": [ { "begin": "\\s*\\b(implements)\\b\\s*", "end": "\\s*(?={)", "beginCaptures": { - "1": { - "name": "keyword.implements.graphql" - } + "1": { "name": "keyword.implements.graphql" } }, "patterns": [ { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { - "name": "support.type.graphql" - } + "1": { "name": "support.type.graphql" } } }, - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#graphql-ampersand" - }, - { - "include": "#graphql-comma" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-ampersand" }, + { "include": "#graphql-comma" } ] }, - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#graphql-type-object" - }, - { - "include": "#literal-quasi-embedded" - }, - { - "include": "#graphql-ignore-spaces" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-type-object" }, + { "include": "#literal-quasi-embedded" }, + { "include": "#graphql-ignore-spaces" } ] }, "graphql-ignore-spaces": { @@ -221,34 +112,18 @@ "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { - "name": "punctuation.operation.graphql" - } + "1": { "name": "punctuation.operation.graphql" } }, "endCaptures": { - "1": { - "name": "punctuation.operation.graphql" - } + "1": { "name": "punctuation.operation.graphql" } }, "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-object-type" - }, - { - "include": "#graphql-type-definition" - }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-object-type" }, + { "include": "#graphql-type-definition" }, + { "include": "#literal-quasi-embedded" } ] }, "graphql-type-definition": { @@ -256,136 +131,74 @@ "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", "end": "(?=\\s*(([_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(})))|\\s*(,)", "beginCaptures": { - "1": { - "name": "variable.graphql" - } + "1": { "name": "variable.graphql" } }, "endCaptures": { - "5": { - "name": "punctuation.comma.graphql" - } + "5": { "name": "punctuation.comma.graphql" } }, "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#graphql-variable-definitions" - }, - { - "include": "#graphql-type-object" - }, - { - "include": "#graphql-colon" - }, - { - "include": "#graphql-input-types" - }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-variable-definitions" }, + { "include": "#graphql-type-object" }, + { "include": "#graphql-colon" }, + { "include": "#graphql-input-types" }, + { "include": "#literal-quasi-embedded" } ] }, "graphql-schema": { "begin": "\\s*\\b(schema)\\b", "end": "(?<=})", "beginCaptures": { - "1": { - "name": "keyword.schema.graphql" - } + "1": { "name": "keyword.schema.graphql" } }, "patterns": [ { "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { - "name": "punctuation.operation.graphql" - } + "1": { "name": "punctuation.operation.graphql" } }, "endCaptures": { - "1": { - "name": "punctuation.operation.graphql" - } + "1": { "name": "punctuation.operation.graphql" } }, "patterns": [ { "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", "end": "(?=\\s*(([_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(})))|\\s*(,)", "beginCaptures": { - "1": { - "name": "variable.arguments.graphql" - } + "1": { "name": "variable.arguments.graphql" } }, "endCaptures": { - "5": { - "name": "punctuation.comma.graphql" - } + "5": { "name": "punctuation.comma.graphql" } }, "patterns": [ { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { - "name": "support.type.graphql" - } + "1": { "name": "support.type.graphql" } } }, - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-colon" - }, - { - "include": "#graphql-skip-newlines" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-colon" }, + { "include": "#graphql-skip-newlines" } ] }, - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-skip-newlines" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-skip-newlines" } ] }, - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#graphql-skip-newlines" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-skip-newlines" } ] }, "graphql-comment": { @@ -435,26 +248,14 @@ "begin": "\\s*(\\()", "end": "\\s*(\\))", "captures": { - "1": { - "name": "meta.brace.round.graphql" - } + "1": { "name": "meta.brace.round.graphql" } }, "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-variable-definition" - }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-variable-definition" }, + { "include": "#literal-quasi-embedded" } ] }, "graphql-variable-definition": { @@ -463,59 +264,31 @@ "begin": "\\s*(\\$?[_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", "end": "(?=\\s*((\\$?[_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(}|\\))))|\\s*(,)", "beginCaptures": { - "1": { - "name": "variable.parameter.graphql" - } + "1": { "name": "variable.parameter.graphql" } }, "endCaptures": { - "5": { - "name": "punctuation.comma.graphql" - } + "5": { "name": "punctuation.comma.graphql" } }, "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#graphql-colon" - }, - { - "include": "#graphql-input-types" - }, - { - "include": "#graphql-variable-assignment" - }, - { - "include": "#literal-quasi-embedded" - }, - { - "include": "#graphql-skip-newlines" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-colon" }, + { "include": "#graphql-input-types" }, + { "include": "#graphql-variable-assignment" }, + { "include": "#literal-quasi-embedded" }, + { "include": "#graphql-skip-newlines" } ] }, "graphql-input-types": { "patterns": [ - { - "include": "#graphql-scalar-type" - }, + { "include": "#graphql-scalar-type" }, { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?:\\s*(!))?", "captures": { - "1": { - "name": "support.type.graphql" - }, - "2": { - "name": "keyword.operator.nulltype.graphql" - } + "1": { "name": "support.type.graphql" }, + "2": { "name": "keyword.operator.nulltype.graphql" } } }, { @@ -523,32 +296,16 @@ "begin": "\\s*(\\[)", "end": "\\s*(\\])(?:\\s*(!))?", "captures": { - "1": { - "name": "meta.brace.square.graphql" - }, - "2": { - "name": "keyword.operator.nulltype.graphql" - } + "1": { "name": "meta.brace.square.graphql" }, + "2": { "name": "keyword.operator.nulltype.graphql" } }, "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-input-types" - }, - { - "include": "#graphql-comma" - }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-input-types" }, + { "include": "#graphql-comma" }, + { "include": "#literal-quasi-embedded" } ] } ] @@ -556,23 +313,15 @@ "graphql-scalar": { "match": "\\s*\\b(scalar)\\b\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { - "name": "keyword.scalar.graphql" - }, - "2": { - "name": "entity.scalar.graphql" - } + "1": { "name": "keyword.scalar.graphql" }, + "2": { "name": "entity.scalar.graphql" } } }, "graphql-scalar-type": { "match": "\\s*\\b(Int|Float|String|Boolean|ID)\\b(?:\\s*(!))?", "captures": { - "1": { - "name": "support.type.builtin.graphql" - }, - "2": { - "name": "keyword.operator.nulltype.graphql" - } + "1": { "name": "support.type.builtin.graphql" }, + "2": { "name": "keyword.operator.nulltype.graphql" } } }, "graphql-variable-assignment": { @@ -580,54 +329,38 @@ "end": "(?=[\n,)])", "applyEndPatternLast": 1, "beginCaptures": { - "1": { - "name": "punctuation.assignment.graphql" - } + "1": { "name": "punctuation.assignment.graphql" } }, - "patterns": [ - { - "include": "#graphql-value" - } - ] + "patterns": [{ "include": "#graphql-value" }] }, "graphql-comma": { "match": "\\s*(,)", "captures": { - "1": { - "name": "punctuation.comma.graphql" - } + "1": { "name": "punctuation.comma.graphql" } } }, "graphql-ampersand": { "match": "\\s*(&)", "captures": { - "1": { - "name": "keyword.operator.logical.graphql" - } + "1": { "name": "keyword.operator.logical.graphql" } } }, "graphql-colon": { "match": "\\s*(:)", "captures": { - "1": { - "name": "punctuation.colon.graphql" - } + "1": { "name": "punctuation.colon.graphql" } } }, "graphql-union-mark": { "match": "\\s*(\\|)", "captures": { - "1": { - "name": "punctuation.union.graphql" - } + "1": { "name": "punctuation.union.graphql" } } }, "graphql-name": { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { - "name": "entity.name.function.graphql" - } + "1": { "name": "entity.name.function.graphql" } } }, "graphql-directive": { @@ -635,29 +368,15 @@ "end": "(?=.)", "applyEndPatternLast": 1, "beginCaptures": { - "1": { - "name": "entity.name.function.directive.graphql" - } + "1": { "name": "entity.name.function.directive.graphql" } }, "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-arguments" - }, - { - "include": "#literal-quasi-embedded" - }, - { - "include": "#graphql-skip-newlines" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-arguments" }, + { "include": "#literal-quasi-embedded" }, + { "include": "#graphql-skip-newlines" } ] }, "graphql-directive-definition": { @@ -736,43 +455,21 @@ "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { - "name": "punctuation.operation.graphql" - } - }, - "endCaptures": { - "1": { - "name": "punctuation.operation.graphql" - } - }, - "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-field" - }, - { - "include": "#graphql-fragment-spread" - }, - { - "include": "#graphql-inline-fragment" - }, - { - "include": "#graphql-comma" - }, - { - "include": "#native-interpolation" - }, - { - "include": "#literal-quasi-embedded" - } + "1": { "name": "punctuation.operation.graphql" } + }, + "endCaptures": { + "1": { "name": "punctuation.operation.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-field" }, + { "include": "#graphql-fragment-spread" }, + { "include": "#graphql-inline-fragment" }, + { "include": "#graphql-comma" }, + { "include": "#native-interpolation" }, + { "include": "#literal-quasi-embedded" } ] }, "graphql-field": { @@ -780,37 +477,21 @@ { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)\\s*(:)", "captures": { - "1": { - "name": "string.unquoted.alias.graphql" - }, - "2": { - "name": "punctuation.colon.graphql" - } + "1": { "name": "string.unquoted.alias.graphql" }, + "2": { "name": "punctuation.colon.graphql" } } }, { "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { - "name": "variable.graphql" - } + "1": { "name": "variable.graphql" } } }, - { - "include": "#graphql-arguments" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#graphql-selection-set" - }, - { - "include": "#literal-quasi-embedded" - }, - { - "include": "#graphql-skip-newlines" - } + { "include": "#graphql-arguments" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-selection-set" }, + { "include": "#literal-quasi-embedded" }, + { "include": "#graphql-skip-newlines" } ] }, "graphql-fragment-spread": { @@ -818,38 +499,18 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { - "name": "keyword.operator.spread.graphql" - }, - "2": { - "name": "variable.fragment.graphql" - } + "1": { "name": "keyword.operator.spread.graphql" }, + "2": { "name": "variable.fragment.graphql" } }, "patterns": [ - { - "include": "#graphql-arguments" - }, - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-selection-set" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#literal-quasi-embedded" - }, - { - "include": "#graphql-skip-newlines" - } + { "include": "#graphql-arguments" }, + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-selection-set" }, + { "include": "#graphql-directive" }, + { "include": "#literal-quasi-embedded" }, + { "include": "#graphql-skip-newlines" } ] }, "graphql-inline-fragment": { @@ -857,38 +518,18 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { - "name": "keyword.operator.spread.graphql" - }, - "2": { - "name": "keyword.on.graphql" - }, - "3": { - "name": "support.type.graphql" - } + "1": { "name": "keyword.operator.spread.graphql" }, + "2": { "name": "keyword.on.graphql" }, + "3": { "name": "support.type.graphql" } }, "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-selection-set" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#graphql-skip-newlines" - }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-selection-set" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-skip-newlines" }, + { "include": "#literal-quasi-embedded" } ] }, "graphql-arguments": { @@ -896,97 +537,59 @@ "begin": "\\s*(\\()", "end": "\\s*(\\))", "beginCaptures": { - "1": { - "name": "meta.brace.round.directive.graphql" - } + "1": { "name": "meta.brace.round.directive.graphql" } }, "endCaptures": { - "1": { - "name": "meta.brace.round.directive.graphql" - } + "1": { "name": "meta.brace.round.directive.graphql" } }, "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, { "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?:\\s*(:))", "end": "(?=\\s*(?:(?:([_A-Za-z][_0-9A-Za-z]*)\\s*(:))|\\)))|\\s*(,)", "beginCaptures": { - "1": { - "name": "variable.parameter.graphql" - }, - "2": { - "name": "punctuation.colon.graphql" - } + "1": { "name": "variable.parameter.graphql" }, + "2": { "name": "punctuation.colon.graphql" } }, "endCaptures": { - "3": { - "name": "punctuation.comma.graphql" - } + "3": { "name": "punctuation.comma.graphql" } }, "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#graphql-value" - }, - { - "include": "#graphql-skip-newlines" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-value" }, + { "include": "#graphql-skip-newlines" } ] }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#literal-quasi-embedded" } ] }, "graphql-variable-name": { "match": "\\s*(\\$[_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { - "name": "variable.graphql" - } + "1": { "name": "variable.graphql" } } }, "graphql-float-value": { "match": "\\s*(-?(0|[1-9][0-9]*)(\\.[0-9]+)?((e|E)(\\+|-)?[0-9]+)?)", "captures": { - "1": { - "name": "constant.numeric.float.graphql" - } + "1": { "name": "constant.numeric.float.graphql" } } }, "graphql-boolean-value": { "match": "\\s*\\b(true|false)\\b", "captures": { - "1": { - "name": "constant.language.boolean.graphql" - } + "1": { "name": "constant.language.boolean.graphql" } } }, "graphql-null-value": { "match": "\\s*\\b(null)\\b", "captures": { - "1": { - "name": "constant.language.null.graphql" - } + "1": { "name": "constant.language.null.graphql" } } }, "graphql-string-value": { @@ -994,31 +597,17 @@ "begin": "\\s*+((\"))", "end": "\\s*+(?:((\"))|(\n))", "beginCaptures": { - "1": { - "name": "string.quoted.double.graphql" - }, - "2": { - "name": "punctuation.definition.string.begin.graphql" - } + "1": { "name": "string.quoted.double.graphql" }, + "2": { "name": "punctuation.definition.string.begin.graphql" } }, "endCaptures": { - "1": { - "name": "string.quoted.double.graphql" - }, - "2": { - "name": "punctuation.definition.string.end.graphql" - }, - "3": { - "name": "invalid.illegal.newline.graphql" - } + "1": { "name": "string.quoted.double.graphql" }, + "2": { "name": "punctuation.definition.string.end.graphql" }, + "3": { "name": "invalid.illegal.newline.graphql" } }, "patterns": [ - { - "include": "#graphql-string-content" - }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#graphql-string-content" }, + { "include": "#literal-quasi-embedded" } ] }, "graphql-string-content": { @@ -1038,12 +627,8 @@ "begin": "\\s*+\\b(enum)\\b\\s*([_A-Za-z][_0-9A-Za-z]*)", "end": "(?<=})", "beginCaptures": { - "1": { - "name": "keyword.enum.graphql" - }, - "2": { - "name": "support.type.enum.graphql" - } + "1": { "name": "keyword.enum.graphql" }, + "2": { "name": "support.type.enum.graphql" } }, "patterns": [ { @@ -1051,51 +636,26 @@ "begin": "\\s*({)", "end": "\\s*(})", "beginCaptures": { - "1": { - "name": "punctuation.operation.graphql" - } + "1": { "name": "punctuation.operation.graphql" } }, "endCaptures": { - "1": { - "name": "punctuation.operation.graphql" - } + "1": { "name": "punctuation.operation.graphql" } }, "patterns": [ - { - "include": "#graphql-object-type" - }, - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-directive" - }, - { - "include": "#graphql-enum-value" - }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#graphql-object-type" }, + + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-enum-value" }, + { "include": "#literal-quasi-embedded" } ] }, - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-directive" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" } ] }, "graphql-enum-value": { @@ -1104,39 +664,17 @@ }, "graphql-value": { "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-variable-name" - }, - { - "include": "#graphql-float-value" - }, - { - "include": "#graphql-string-value" - }, - { - "include": "#graphql-boolean-value" - }, - { - "include": "#graphql-null-value" - }, - { - "include": "#graphql-enum-value" - }, - { - "include": "#graphql-list-value" - }, - { - "include": "#graphql-object-value" - }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-variable-name" }, + { "include": "#graphql-float-value" }, + { "include": "#graphql-string-value" }, + { "include": "#graphql-boolean-value" }, + { "include": "#graphql-null-value" }, + { "include": "#graphql-enum-value" }, + { "include": "#graphql-list-value" }, + { "include": "#graphql-object-value" }, + { "include": "#literal-quasi-embedded" } ] }, "graphql-list-value": { @@ -1146,20 +684,12 @@ "begin": "\\s*+(\\[)", "end": "\\s*(\\])", "endCaptures": { - "1": { - "name": "meta.brace.square.graphql" - } + "1": { "name": "meta.brace.square.graphql" } }, "beginCaptures": { - "1": { - "name": "meta.brace.square.graphql" - } + "1": { "name": "meta.brace.square.graphql" } }, - "patterns": [ - { - "include": "#graphql-value" - } - ] + "patterns": [{ "include": "#graphql-value" }] } ] }, @@ -1170,22 +700,14 @@ "begin": "\\s*+({)", "end": "\\s*(})", "beginCaptures": { - "1": { - "name": "meta.brace.curly.graphql" - } + "1": { "name": "meta.brace.curly.graphql" } }, "endCaptures": { - "1": { - "name": "meta.brace.curly.graphql" - } + "1": { "name": "meta.brace.curly.graphql" } }, "patterns": [ - { - "include": "#graphql-object-field" - }, - { - "include": "#graphql-value" - } + { "include": "#graphql-object-field" }, + { "include": "#graphql-value" } ] } ] @@ -1193,15 +715,9 @@ "graphql-object-field": { "match": "\\s*(([_A-Za-z][_0-9A-Za-z]*))\\s*(:)", "captures": { - "1": { - "name": "constant.object.key.graphql" - }, - "2": { - "name": "string.unquoted.graphql" - }, - "3": { - "name": "punctuation.graphql" - } + "1": { "name": "constant.object.key.graphql" }, + "2": { "name": "string.unquoted.graphql" }, + "3": { "name": "punctuation.graphql" } } }, "graphql-union": { @@ -1209,12 +725,8 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { - "name": "keyword.union.graphql" - }, - "2": { - "name": "support.type.graphql" - } + "1": { "name": "keyword.union.graphql" }, + "2": { "name": "support.type.graphql" } }, "patterns": [ { @@ -1222,57 +734,29 @@ "end": "(?=.)", "applyEndPatternLast": 1, "captures": { - "1": { - "name": "punctuation.assignment.graphql" - }, - "2": { - "name": "support.type.graphql" - } + "1": { "name": "punctuation.assignment.graphql" }, + "2": { "name": "support.type.graphql" } }, "patterns": [ - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-skip-newlines" - }, - { - "include": "#literal-quasi-embedded" - }, + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-skip-newlines" }, + { "include": "#literal-quasi-embedded" }, { "match": "\\s*(\\|)\\s*([_A-Za-z][_0-9A-Za-z]*)", "captures": { - "1": { - "name": "punctuation.or.graphql" - }, - "2": { - "name": "support.type.graphql" - } + "1": { "name": "punctuation.or.graphql" }, + "2": { "name": "support.type.graphql" } } } ] }, - { - "include": "#graphql-comment" - }, - { - "include": "#graphql-description-docstring" - }, - { - "include": "#graphql-description-singleline" - }, - { - "include": "#graphql-skip-newlines" - }, - { - "include": "#literal-quasi-embedded" - } + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-skip-newlines" }, + { "include": "#literal-quasi-embedded" } ] }, "native-interpolation": { @@ -1280,28 +764,16 @@ "begin": "\\s*(\\${)", "end": "(})", "beginCaptures": { - "1": { - "name": "keyword.other.substitution.begin" - } + "1": { "name": "keyword.other.substitution.begin" } }, "endCaptures": { - "1": { - "name": "keyword.other.substitution.end" - } + "1": { "name": "keyword.other.substitution.end" } }, "patterns": [ - { - "include": "source.js" - }, - { - "include": "source.ts" - }, - { - "include": "source.js.jsx" - }, - { - "include": "source.tsx" - } + { "include": "source.js" }, + { "include": "source.ts" }, + { "include": "source.js.jsx" }, + { "include": "source.tsx" } ] }, "graphql-skip-newlines": { From 26e767cc23933f0d44cafb2a0fa6a23cc22513df Mon Sep 17 00:00:00 2001 From: Maikel van Dort Date: Wed, 7 Jan 2026 10:50:42 +0100 Subject: [PATCH 3/4] fix: key --- packages/vscode-graphql-syntax/grammars/graphql.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/vscode-graphql-syntax/grammars/graphql.json b/packages/vscode-graphql-syntax/grammars/graphql.json index d1ffb88de90..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|subscription|mutation)\\b", + "graphql-query-mutation-subscription": { + "match": "\\s*\\b(query|mutation|subscription)\\b", "captures": { "1": { "name": "keyword.operation.graphql" } } From 68578074d7b738b559d5e3923f5a53927f9cd8e6 Mon Sep 17 00:00:00 2001 From: Maikel van Dort Date: Wed, 7 Jan 2026 14:31:28 +0100 Subject: [PATCH 4/4] test: update snapshot --- .../tests/__snapshots__/graphql-grammar.spec.ts.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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