diff --git a/mlir/utils/vscode/cpp-grammar.json b/mlir/utils/vscode/cpp-grammar.json new file mode 100644 --- /dev/null +++ b/mlir/utils/vscode/cpp-grammar.json @@ -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" + } + ] + } + ] + } + } +} diff --git a/mlir/utils/vscode/package.json b/mlir/utils/vscode/package.json --- a/mlir/utils/vscode/package.json +++ b/mlir/utils/vscode/package.json @@ -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": {