[mlir][vscode] Highlight inside c++ raw strings

Within C++ raw strings with mlir delimitter use MLIR syntax.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D115963
This commit is contained in:
Jacques Pienaar 2021-12-17 12:55:44 -08:00
parent 71fe59212c
commit 2d4f3ed551
2 changed files with 170 additions and 116 deletions

View File

@ -0,0 +1,44 @@
{
"scopeName": "source.cpp.mlir",
"injectionSelector": "L:source.cpp",
"patterns": [
{
"include": "#mlir-raw-string"
}
],
"repository": {
"mlir-raw-string": {
"begin": "R\"(?i:mlir)(\\()",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.cpp"
},
"1": {
"name": "mlir.delimeter.raw.string.cpp"
}
},
"end": "\\)(?i:mlir)\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.cpp"
},
"1": {
"name": "mlir.delimeter.raw.string.cpp"
}
},
"name": "mlir.raw.string.cpp",
"patterns": [
{
"contentName": "source.mlir",
"begin": "(?!\\G)",
"end": "(?i)(?=\\)mlir\")",
"patterns": [
{
"include": "source.mlir"
}
]
}
]
}
}
}

View File

@ -2,7 +2,7 @@
"name": "vscode-mlir",
"displayName": "MLIR",
"description": "MLIR Language Extension",
"version": "0.0.2",
"version": "0.0.3",
"publisher": "llvm-vs-code-extensions",
"homepage": "https://mlir.llvm.org/",
"icon": "icon.png",
@ -80,6 +80,16 @@
"embeddedLanguages": {
"meta.embedded.block.mlir": "mlir"
}
},
{
"scopeName": "source.cpp.mlir",
"path": "./cpp-grammar.json",
"injectTo": [
"source.cpp"
],
"embeddedLanguages": {
"source.mlir": "mlir"
}
}
],
"configuration": {