Skip to content

Commit 37c0de9

Browse files
committed
Merge PR barklan#98
2 parents ff65eb4 + d2d1120 commit 37c0de9

3 files changed

Lines changed: 91 additions & 0 deletions

File tree

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"source.svelte",
6767
"source.tsx",
6868
"source.rust",
69+
"source.dart",
6970
"text.html.php"
7071
],
7172
"embeddedLanguages": {
@@ -136,6 +137,16 @@
136137
"embeddedLanguages": {
137138
"meta.embedded.sql": "sql"
138139
}
140+
},
141+
{
142+
"path": "./syntaxes/dart-multiline.json",
143+
"scopeName": "dart-multiline.injection",
144+
"injectTo": [
145+
"source.dart"
146+
],
147+
"embeddedLanguages": {
148+
"meta.embedded.sql": "sql"
149+
}
139150
}
140151
],
141152
"configuration": {

syntaxes/dart-multiline.json

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"scopeName": "dart-multiline.injection",
3+
"fileTypes": [
4+
"dart"
5+
],
6+
"injectionSelector": [
7+
"L:source -comment -string"
8+
],
9+
"patterns": [
10+
{
11+
"comment": "Dart single-quote multi-lines strings",
12+
"begin": "(''')(--\\s*sql)",
13+
"beginCaptures": {
14+
"2": {
15+
"name": "comment.sql"
16+
}
17+
},
18+
"end": "(''')",
19+
"patterns": [
20+
{
21+
"include": "source.sql"
22+
}
23+
]
24+
},
25+
{
26+
"comment": "Dart single-quote multi-lines strings",
27+
"begin": "(''')(SELECT |INSERT INTO |DELETE |UPDATE |CREATE TABLE |CREATE INDEX)",
28+
"beginCaptures": {
29+
"2": {
30+
"name": "keyword.sql"
31+
}
32+
},
33+
"end": "(''')",
34+
"patterns": [
35+
{
36+
"include": "source.sql"
37+
}
38+
]
39+
},
40+
{
41+
"comment": "Dart double-quote multi-lines strings",
42+
"begin": "(\"\"\")(--\\s*sql)",
43+
"beginCaptures": {
44+
"2": {
45+
"name": "comment.sql"
46+
}
47+
},
48+
"end": "(\"\"\")",
49+
"patterns": [
50+
{
51+
"include": "source.sql"
52+
}
53+
]
54+
},
55+
{
56+
"comment": "Dart double-quote multi-lines strings",
57+
"begin": "(\"\"\")(SELECT |INSERT INTO |DELETE |UPDATE |CREATE TABLE |CREATE INDEX)",
58+
"beginCaptures": {
59+
"2": {
60+
"name": "keyword.sql"
61+
}
62+
},
63+
"end": "(\"\"\")",
64+
"patterns": [
65+
{
66+
"include": "source.sql"
67+
}
68+
]
69+
}
70+
]
71+
}

test/testdata/multiline.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const singleQuoteMultiLineComment = '''--sql
2+
select * from `table`''';
3+
4+
const singleQuoteMultiLine = '''select * from table''';
5+
6+
const doubleQuoteMultiLineComment = """--sql
7+
select * from `table`""";
8+
9+
const doubleQuoteMultiLine = """select * from table""";

0 commit comments

Comments
 (0)