diff --git a/.changeset/neat-frogs-trade.md b/.changeset/neat-frogs-trade.md new file mode 100644 index 00000000..ca5049bd --- /dev/null +++ b/.changeset/neat-frogs-trade.md @@ -0,0 +1,5 @@ +--- +"vscode-apollo": minor +--- + +Add inline syntax highlighting support for Lua diff --git a/package.json b/package.json index 06dcdb29..1760c63b 100644 --- a/package.json +++ b/package.json @@ -175,6 +175,16 @@ "meta.embedded.block.graphql": "graphql" } }, + { + "injectTo": [ + "source.lua" + ], + "scopeName": "inline.graphql.lua", + "path": "./syntaxes/graphql.lua.json", + "embeddedLanguages": { + "meta.embedded.block.graphql": "graphql" + } + }, { "injectTo": [ "source.ruby" diff --git a/syntaxes/graphql.lua.json b/syntaxes/graphql.lua.json new file mode 100644 index 00000000..53cb1b7d --- /dev/null +++ b/syntaxes/graphql.lua.json @@ -0,0 +1,51 @@ +{ + "fileTypes": ["lua", "luau"], + "injectionSelector": "L:source -string -comment", + "patterns": [ + { + "contentName": "meta.embedded.block.graphql", + "begin": "(--\\[\\[)\\s*(gql)\\s*(\\]\\])\\s*(\\[\\[)", + "beginCaptures": { + "1": { + "name": "comment.block.lua" + }, + "2": { + "name": "entity.name.function.lua" + }, + "3": { + "name": "comment.block.lua" + }, + "4": { + "name": "string.quoted.double.lua" + } + }, + "end": "(\\]\\])", + "endCaptures": { + "1": { + "name": "string.quoted.double.lua" + } + }, + "patterns": [{ "include": "source.graphql" }] + }, + { + "contentName": "meta.embedded.block.graphql", + "begin": "(gql)\\(?\\s*(\\[\\[)", + "beginCaptures": { + "1": { + "name": "entity.name.function.lua" + }, + "2": { + "name": "string.quoted.double.lua" + } + }, + "end": "(\\]\\])", + "endCaptures": { + "1": { + "name": "string.quoted.double.lua" + } + }, + "patterns": [{ "include": "source.graphql" }] + } + ], + "scopeName": "inline.graphql.lua" +}