Skip to content

Commit eaeedf7

Browse files
lukasrgrunber
authored andcommitted
Add SQL block highlighting support
1 parent 1cb8d0c commit eaeedf7

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

language-support/sql/inline-sql.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"injectionSelector": "L:source.java -comment -string",
3+
"patterns": [
4+
{
5+
"contentName": "meta.embedded.block.sql",
6+
"begin": "(?i)((/\\*\\s*(language=sql)\\s*\\*/)|((//\\s*(language=sql)\\s*)))",
7+
"beginCaptures": {
8+
"1": {
9+
"name": "comment.block"
10+
}
11+
},
12+
"end": "(?<=\")",
13+
"patterns": [
14+
{
15+
"begin": "\\s*(\"\"\")$",
16+
"beginCaptures": {
17+
"0": { "name": "string.quoted.triple.java" }
18+
},
19+
"end": "\\s*(\"\"\")",
20+
"endCaptures": {
21+
"0": { "name": "string.quoted.triple.java" }
22+
},
23+
"patterns": [
24+
{ "include": "source.sql" },
25+
{ "include": "source.plpgsql.postgres" }
26+
]
27+
},
28+
{
29+
"begin": "\\s*(\")",
30+
"beginCaptures": {
31+
"0": { "name": "string.quoted.double.java" }
32+
},
33+
"end": "\\s*(\")",
34+
"endCaptures": {
35+
"0": { "name": "string.quoted.double.java" }
36+
},
37+
"patterns": [
38+
{ "include": "source.sql" },
39+
{ "include": "source.plpgsql.postgres" }
40+
]
41+
}
42+
]
43+
}
44+
],
45+
"scopeName": "inline.sql"
46+
}

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,16 @@
212212
"language": "gradle-kotlin-dsl",
213213
"scopeName": "source.kotlin",
214214
"path": "./language-support/kotlin/kotlin.tmLanguage.json"
215+
},
216+
{
217+
"injectTo": [
218+
"source.java"
219+
],
220+
"scopeName": "inline.sql",
221+
"path": "./language-support/sql/inline-sql.json",
222+
"embeddedLanguages": {
223+
"meta.embedded.block.sql": "sql"
224+
}
215225
}
216226
],
217227
"jsonValidation": [

0 commit comments

Comments
 (0)