forked from OSchip/llvm-project
[vscode-mlir] Add proper support for mlir markdown codeblocks
A special language contribution is required for properly supporting markdown code blocks in vscodes builtin markdown grammar, see https://github.com/mjbvz/vscode-fenced-code-block-grammar-injection-example for more details.
This commit is contained in:
parent
81b293ba36
commit
0d74bd332d
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"fileTypes": [],
|
||||
"injectionSelector": "L:text.html.markdown",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#mlir-code-block"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"mlir-code-block": {
|
||||
"begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(mlir)(\\s+[^`~]*)?$)",
|
||||
"name": "markup.fenced_code.block.markdown",
|
||||
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
|
||||
"beginCaptures": {
|
||||
"3": {
|
||||
"name": "punctuation.definition.markdown"
|
||||
},
|
||||
"4": {
|
||||
"name": "fenced_code.block.language.markdown"
|
||||
},
|
||||
"5": {
|
||||
"name": "fenced_code.block.language.attributes.markdown"
|
||||
}
|
||||
},
|
||||
"endCaptures": {
|
||||
"3": {
|
||||
"name": "punctuation.definition.markdown"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "(^|\\G)(\\s*)(.*)",
|
||||
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
|
||||
"contentName": "meta.embedded.block.mlir",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.mlir"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scopeName": "markdown.mlir.codeblock"
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "vscode-mlir",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "vscode-mlir",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"dependencies": {
|
||||
"chokidar": "3.5.2",
|
||||
"vscode-languageclient": "^5.2.1",
|
||||
|
@ -343,6 +343,7 @@
|
|||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
"fsevents": "~2.3.2",
|
||||
"glob-parent": "~5.1.2",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "vscode-mlir",
|
||||
"displayName": "MLIR",
|
||||
"description": "MLIR Language Extension",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"publisher": "llvm-vs-code-extensions",
|
||||
"homepage": "https://mlir.llvm.org/",
|
||||
"icon": "icon.png",
|
||||
|
@ -44,8 +44,8 @@
|
|||
"vscode-test": "^1.3.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/llvm/vscode-mlir.git"
|
||||
"type": "git",
|
||||
"url": "https://github.com/llvm/vscode-mlir.git"
|
||||
},
|
||||
"contributes": {
|
||||
"languages": [
|
||||
|
@ -59,6 +59,9 @@
|
|||
".mlir"
|
||||
],
|
||||
"configuration": "./language-configuration.json"
|
||||
},
|
||||
{
|
||||
"id": "mlir-injection"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
|
@ -66,6 +69,17 @@
|
|||
"language": "mlir",
|
||||
"scopeName": "source.mlir",
|
||||
"path": "./grammar.json"
|
||||
},
|
||||
{
|
||||
"language": "mlir-injection",
|
||||
"scopeName": "markdown.mlir.codeblock",
|
||||
"path": "markdown-grammar.json",
|
||||
"injectTo": [
|
||||
"text.html.markdown"
|
||||
],
|
||||
"embeddedLanguages": {
|
||||
"meta.embedded.block.mlir": "mlir"
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
|
|
Loading…
Reference in New Issue