@@ -53,6 +53,18 @@ variables:
5353
5454 method_param_type_modifier : \b(?:out|ref|this|params|in)\b
5555
56+ sql_indicator : |-
57+ (?x: \s* (?:
58+ # dml statements
59+ SELECT | INSERT | REPLACE | DELETE | TRUNCATE | UPDATE | MERGE\s+INTO
60+ # ddl statements
61+ | ADD | ALTER | CREATE | DROP
62+ # conditional
63+ | IF \s+ (?: NOT \s+ )? EXISTS
64+ # declaration
65+ | DECLARE | WITH | BEGIN
66+ ) \s )
67+
5668contexts :
5769 prototype :
5870 - include : comments
@@ -1825,9 +1837,14 @@ contexts:
18251837 - include : strings
18261838
18271839 strings :
1828- - match : ' ("""+)'
1840+ - match : ' ("""" +)'
18291841 scope : punctuation.definition.string.begin.cs
18301842 push : inside_raw_string_literal
1843+ - match : ' """'
1844+ scope : punctuation.definition.string.begin.cs
1845+ push :
1846+ - inside_triple_quoted_raw_string_literal
1847+ - inside_triple_quoted_raw_string_literal_syntax
18311848 - match : ' "'
18321849 scope : punctuation.definition.string.begin.cs
18331850 push : inside_string
@@ -1850,22 +1867,46 @@ contexts:
18501867 # multi-line strings
18511868 - match : ' @"'
18521869 scope : punctuation.definition.string.begin.cs
1853- push : inside_long_string
1870+ push :
1871+ - inside_long_string
1872+ - inside_long_string_syntax
18541873 # interpolated multi-line strings
18551874 - match : ' (@\$|\$@)"'
18561875 scope : punctuation.definition.string.begin.cs
1857- push : inside_long_format_string
1876+ push :
1877+ - inside_long_format_string
1878+ - inside_long_format_string_syntax
18581879
18591880 inside_raw_string_literal :
18601881 - meta_include_prototype : false
1861- - meta_scope : string.quoted.triple.cs
1862- - include : string_escaped
1882+ - meta_scope : meta.string.cs string.quoted.triple.cs
18631883 - match : ' \1'
18641884 scope : punctuation.definition.string.end.cs
18651885 pop : true
1886+ - include : string_escaped
18661887 - include : string_placeholders
18671888 - include : extended_string_placeholders
18681889
1890+ inside_triple_quoted_raw_string_literal :
1891+ - meta_include_prototype : false
1892+ - meta_scope : meta.string.cs string.quoted.triple.cs
1893+ - match : ' """'
1894+ scope : punctuation.definition.string.end.cs
1895+ pop : true
1896+ - include : string_escaped
1897+ - include : string_placeholders
1898+ - include : extended_string_placeholders
1899+
1900+ inside_triple_quoted_raw_string_literal_syntax :
1901+ - meta_include_prototype : false
1902+ - match : (?={{sql_indicator}})
1903+ set : scope:source.sql
1904+ with_prototype :
1905+ - match : (?=""")
1906+ pop : true
1907+ - match : (?=\S)
1908+ pop : true
1909+
18691910 inside_string :
18701911 - meta_include_prototype : false
18711912 - meta_scope : meta.string.cs string.quoted.double.cs
@@ -1972,6 +2013,21 @@ contexts:
19722013 scope : punctuation.section.interpolation.begin.cs
19732014 push : inside_long_format_string_interpolation
19742015
2016+ inside_long_format_string_syntax :
2017+ - meta_include_prototype : false
2018+ - match : (?={{sql_indicator}})
2019+ set : scope:source.sql
2020+ with_prototype :
2021+ - include : long_string_escaped
2022+ - match : (?=")
2023+ pop : true
2024+ - include : string_placeholder_escape
2025+ - match : \{
2026+ scope : punctuation.section.interpolation.begin.cs
2027+ push : inside_long_format_string_interpolation
2028+ - match : (?=\S)
2029+ pop : true
2030+
19752031 inside_long_format_string_interpolation :
19762032 - clear_scopes : 1
19772033 - meta_scope : meta.interpolation.cs
@@ -2082,14 +2138,27 @@ contexts:
20822138
20832139 inside_long_string :
20842140 - meta_include_prototype : false
2085- - meta_scope : string.quoted.double.raw.cs
2141+ - meta_scope : meta.string.cs string.quoted.double.raw.cs
20862142 - include : long_string_escaped
20872143 - match : ' "'
20882144 scope : punctuation.definition.string.end.cs
20892145 pop : true
20902146 - include : string_placeholders
20912147 - include : extended_long_string_placeholders
20922148
2149+ inside_long_string_syntax :
2150+ - meta_include_prototype : false
2151+ - match : (?={{sql_indicator}})
2152+ set : scope:source.sql
2153+ with_prototype :
2154+ - include : long_string_escaped
2155+ - match : (?=")
2156+ pop : true
2157+ - include : string_placeholders
2158+ - include : extended_long_string_placeholders
2159+ - match : (?=\S)
2160+ pop : true
2161+
20932162 escaped :
20942163 - match : ' {{escaped_char}}'
20952164 scope : constant.character.escape.cs
0 commit comments