Skip to content

Commit 6b1ce18

Browse files
authored
Merge pull request #469 from hsfzxjy/main
Fix injectionSelector of Kotlin markdown code block
2 parents 47f7e0c + 70560af commit 6b1ce18

File tree

2 files changed

+59
-16
lines changed

2 files changed

+59
-16
lines changed

grammars/codeblock.json

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,42 @@
11
{
22
"fileTypes": [],
3-
"injectionSelector": "L:markup.fenced_code.block.markdown",
3+
"injectionSelector": "L:text.html.markdown",
44
"patterns": [
55
{
66
"include": "#kotlin-code-block"
77
}
88
],
99
"repository": {
1010
"kotlin-code-block": {
11-
"begin": "kotlin",
12-
"end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)",
13-
"contentName": "meta.embedded.block.kotlin",
11+
"begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(kotlin)(\\s+[^`~]*)?$)",
12+
"name": "markup.fenced_code.block.markdown",
13+
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
14+
"beginCaptures": {
15+
"3": {
16+
"name": "punctuation.definition.markdown"
17+
},
18+
"4": {
19+
"name": "fenced_code.block.language.markdown"
20+
},
21+
"5": {
22+
"name": "fenced_code.block.language.attributes.markdown"
23+
}
24+
},
25+
"endCaptures": {
26+
"3": {
27+
"name": "punctuation.definition.markdown"
28+
}
29+
},
1430
"patterns": [
1531
{
16-
"include": "source.kotlin"
32+
"begin": "(^|\\G)(\\s*)(.*)",
33+
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
34+
"contentName": "meta.embedded.block.kotlin",
35+
"patterns": [
36+
{
37+
"include": "source.kotlin"
38+
}
39+
]
1740
}
1841
]
1942
}

grammars/vscode-grammar-dev/package.json

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,36 @@
1010
"Programming Languages"
1111
],
1212
"contributes": {
13-
"languages": [{
14-
"id": "kotlin",
15-
"aliases": ["Kotlin", "kotlin"],
16-
"extensions": [".kt",".kts"],
17-
"configuration": "../kotlin.configuration.json"
18-
}],
19-
"grammars": [{
20-
"language": "kotlin",
21-
"scopeName": "source.kotlin",
22-
"path": "../Kotlin.tmLanguage.json"
23-
}]
13+
"languages": [
14+
{
15+
"id": "kotlin",
16+
"aliases": [
17+
"Kotlin",
18+
"kotlin"
19+
],
20+
"extensions": [
21+
".kt",
22+
".kts"
23+
],
24+
"configuration": "../kotlin.configuration.json"
25+
}
26+
],
27+
"grammars": [
28+
{
29+
"language": "kotlin",
30+
"scopeName": "source.kotlin",
31+
"path": "../Kotlin.tmLanguage.json"
32+
},
33+
{
34+
"scopeName": "markdown.kotlin.codeblock",
35+
"path": "../codeblock.json",
36+
"injectTo": [
37+
"text.html.markdown"
38+
],
39+
"embeddedLanguages": {
40+
"meta.embedded.block.kotlin": "kotlin"
41+
}
42+
}
43+
]
2444
}
2545
}

0 commit comments

Comments
 (0)