mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 13:40:11 +01:00
Update Textmate for types in a list and add unused keyword (#7535)
Setting "type" to bright red to make comparison obvious: (screenshots taken from VSCode) Before <img width="446" height="150" alt="Screenshot 2026-07-20 135558" src="https://github.com/user-attachments/assets/81249005-99f1-47bb-af4f-ad6e8f2404fb" /> After <img width="429" height="149" alt="Screenshot 2026-07-20 135738" src="https://github.com/user-attachments/assets/acc83086-fe19-4a18-a833-968daed56229" /> I'm not super familiar with textmate/highlightjs, but I think what was happening on line 5 is that the "type" scope is being extended to the `=` after `.y`. Adding `,` as an "end" token fixes this, and I think this is what highlightjs already does. I've also added "unused" as a keyword.
This commit is contained in:
@@ -72,6 +72,7 @@ export default function (hljs) {
|
||||
'then',
|
||||
'type',
|
||||
'_',
|
||||
'unused',
|
||||
'var',
|
||||
'virtual',
|
||||
'where',
|
||||
|
||||
@@ -607,7 +607,7 @@ THIS FILE IS AUTOGENERATED FROM carbon.tmLanguage.json. DO NOT EDIT.
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\b(and|as|generic|impls|in|like|not|or|partial|ref|runtime|template|where)\b</string>
|
||||
<string>\b(and|as|generic|impls|in|like|not|or|partial|ref|runtime|template|unused|where)\b</string>
|
||||
<key>name</key>
|
||||
<string>keyword.control.carbon</string>
|
||||
</dict>
|
||||
@@ -801,7 +801,7 @@ THIS FILE IS AUTOGENERATED FROM carbon.tmLanguage.json. DO NOT EDIT.
|
||||
<key>comment</key>
|
||||
<string>Matches types in bindings.</string>
|
||||
<key>end</key>
|
||||
<string>(?=([;{=]|->|in|where))</string>
|
||||
<string>(?=([;{=,]|->|in|where))</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
{
|
||||
"comment": "Matches types in bindings.",
|
||||
"begin": ":",
|
||||
"end": "(?=([;{=]|->|in|where))",
|
||||
"end": "(?=([;{=,]|->|in|where))",
|
||||
"patterns": [
|
||||
{ "include": "#common" },
|
||||
{ "include": "#variables" },
|
||||
@@ -346,7 +346,7 @@
|
||||
},
|
||||
{
|
||||
"name": "keyword.control.carbon",
|
||||
"match": "\\b(and|as|generic|impls|in|like|not|or|partial|ref|runtime|template|where)\\b"
|
||||
"match": "\\b(and|as|generic|impls|in|like|not|or|partial|ref|runtime|template|unused|where)\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user