Skip to content

Commit

Permalink
Add inline syntax highlighting support for Lua (#105)
Browse files Browse the repository at this point in the history
* Add lua grammar

* For some reason tsconfig needs to be included or punctuation highlights are missing

* Never mind it was just flaky

* Support comment tagged string syntax

* chore: add changeset

---------

Co-authored-by: Alessia Bellisario <github@bellisar.io>
  • Loading branch information
zovits and alessbell committed Oct 16, 2023
1 parent 0f78b4a commit 43879da
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/neat-frogs-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vscode-apollo": minor
---

Add inline syntax highlighting support for Lua
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
51 changes: 51 additions & 0 deletions syntaxes/graphql.lua.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 43879da

Please sign in to comment.