Quellcode durchsuchen

Add filetype highlighting to block string literals (#3642)

This PR adds filetype highlighting support to block string literals in
the TextMate grammar.

After adding the regex in the `begin` of the block string literal,
`beginCaptures` is used to access the first capturing group of the regex
(which captures the filetype) and apply the `constant.character.escape`
rule.


![image](https://github.com/carbon-language/carbon-lang/assets/116057817/edabc820-ed0f-4f5f-a180-f3ac90045b0a)

Closes #3641
Karthik Prakash vor 2 Jahren
Ursprung
Commit
af6436c20c
1 geänderte Dateien mit 9 neuen und 2 gelöschten Zeilen
  1. 9 2
      utils/textmate/Syntaxes/Carbon.plist

+ 9 - 2
utils/textmate/Syntaxes/Carbon.plist

@@ -82,10 +82,17 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
                 <key>name</key>
                 <string>string.quoted.triple.carbon</string>
                 <key>begin</key>
-                <string>'''</string>
+                <string>'''([^\s'#]*\n)?</string>
                 <key>end</key>
                 <string>'''</string>
-
+                <key>beginCaptures</key>
+                <dict>
+                    <key>1</key>
+                    <dict>
+                        <key>name</key>
+                        <string>constant.character.escape.carbon</string>
+                    </dict>
+                </dict>
                 <key>patterns</key>
                 <array>
                     <dict>