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:
oli-ej
2026-07-20 22:37:37 +00:00
committed by GitHub
parent 4b46e63b41
commit 0553d5f165
3 changed files with 5 additions and 4 deletions
@@ -72,6 +72,7 @@ export default function (hljs) {
'then',
'type',
'_',
'unused',
'var',
'virtual',
'where',
+2 -2
View File
@@ -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>(?=([;{=]|-&gt;|in|where))</string>
<string>(?=([;{=,]|-&gt;|in|where))</string>
<key>patterns</key>
<array>
<dict>
+2 -2
View File
@@ -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"
}
]
},