Files
carbon-lang/utils/vscode/carbon-testdata.tmLanguage.json
T
Richard Smith 805dca1dc3 Use C++ formatting for C++ splits in testdata files. (#7385)
Refactor the textmate grammar to use a different scope for testdata
files. Move the existing handling for `CHECK:STDOUT:` there, and add
handling for C++ file splits there too.

Assisted-by: Gemini via Antigravity
2026-06-18 14:47:34 +00:00

57 lines
1.3 KiB
JSON

{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "carbon-testdata",
"scopeName": "source.carbon-testdata",
"fileTypes": [],
"patterns": [
{
"include": "#cpp-file-splits"
},
{
"include": "#check-stdout"
},
{
"include": "source.carbon"
}
],
"repository": {
"cpp-file-splits": {
"patterns": [
{
"comment": "C++ file split in test files",
"begin": "^//\\s*---\\s*([^\\s]+\\.(h|hh|hpp|hxx|h\\+\\+|cpp|cc|cxx|c\\+\\+|c|H|HH|HPP|HXX|H\\+\\+|CPP|CC|CXX|C\\+\\+|C))\\s*$",
"beginCaptures": {
"0": { "name": "comment.line.carbon" }
},
"end": "^(?=//\\s*---)",
"contentName": "meta.embedded.block.cpp",
"patterns": [
{
"include": "source.cpp"
}
]
}
]
},
"check-stdout": {
"patterns": [
{
"comment": "Highlight compile output / SemIR in CHECK:STDOUT lines",
"begin": "^(\\s*//\\s*CHECK:STDOUT:)",
"beginCaptures": {
"1": {
"name": "comment.line.carbon"
}
},
"end": "$",
"patterns": [
{
"include": "source.carbon-semir"
}
]
}
]
}
}
}