Skip to content

Commit 802aa70

Browse files
Fix inline SQL for block strings with starting new lines
1 parent 8933c52 commit 802aa70

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

grammars/python.cson

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@
11371137
]
11381138
}
11391139
{
1140-
'begin': '(""")(?=\\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER))'
1140+
'begin': '(""")'
11411141
'beginCaptures':
11421142
'1':
11431143
'name': 'punctuation.definition.string.begin.python'
@@ -1151,13 +1151,19 @@
11511151
'name': 'string.quoted.double.block.sql.python'
11521152
'patterns': [
11531153
{
1154-
'include': '#constant_placeholder'
1154+
'begin': '(?=\\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER))'
1155+
'end': '(?=\\s*""")'
1156+
'patterns': [
1157+
{
1158+
'include': 'source.sql'
1159+
}
1160+
]
11551161
}
11561162
{
1157-
'include': '#escaped_char'
1163+
'include': '#constant_placeholder'
11581164
}
11591165
{
1160-
'include': 'source.sql'
1166+
'include': '#escaped_char'
11611167
}
11621168
]
11631169
}
@@ -1499,7 +1505,7 @@
14991505
]
15001506
}
15011507
{
1502-
'begin': '(\'\'\')(?=\\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER))'
1508+
'begin': '(\'\'\')'
15031509
'beginCaptures':
15041510
'1':
15051511
'name': 'punctuation.definition.string.begin.python'
@@ -1510,16 +1516,22 @@
15101516
'name': 'punctuation.definition.string.end.python'
15111517
'2':
15121518
'name': 'meta.empty-string.single.python'
1513-
'name': 'string.quoted.single.block.python'
1519+
'name': 'string.quoted.single.block.sql.python'
15141520
'patterns': [
15151521
{
1516-
'include': '#constant_placeholder'
1522+
'begin': '(?=\\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER))'
1523+
'end': '(?=\\s*\'\'\')'
1524+
'patterns': [
1525+
{
1526+
'include': 'source.sql'
1527+
}
1528+
]
15171529
}
15181530
{
1519-
'include': '#escaped_char'
1531+
'include': '#constant_placeholder'
15201532
}
15211533
{
1522-
'include': 'source.sql'
1534+
'include': '#escaped_char'
15231535
}
15241536
]
15251537
}

0 commit comments

Comments
 (0)