Skip to content

Commit 2ec0f50

Browse files
authored
Fix syntax highlighting for multi-line descriptions (#5)
1 parent 59e5a19 commit 2ec0f50

File tree

1 file changed

+40
-28
lines changed

1 file changed

+40
-28
lines changed

syntaxes/xit.tmLanguage.json

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,29 @@
33
"name": "xit!",
44
"patterns": [
55
{
6-
"include": "#open-items"
7-
},
8-
{
9-
"include": "#closed-items"
6+
"include": "#item"
107
},
118
{
129
"include": "#title"
13-
},
14-
{
15-
"include": "#nextline-description"
1610
}
1711
],
1812
"repository": {
1913
"title": {
2014
"name": "markup.underline.xit, markup.other.task.title.xit",
2115
"match": "^[^\\s].*"
2216
},
23-
"nextline-description": {
24-
"match": "^ .+"
17+
"item": {
18+
"patterns": [
19+
{
20+
"include": "#open-item"
21+
},
22+
{
23+
"include": "#closed-item"
24+
}
25+
]
2526
},
26-
"open-items": {
27-
"begin": "^(?:(\\[ ?\\])|(\\[@\\]))(?= |$)",
27+
"open-item": {
28+
"begin": "^(?:(\\[ *\\])|(\\[@\\]))[^\\S\\n]*(.*(?= |$))",
2829
"beginCaptures": {
2930
"1": {
3031
"name": "variable.function.xit, markup.other.task.checkbox.open.xit"
@@ -33,34 +34,45 @@
3334
"name": "storage.type.xit, markup.other.task.checkbox.ongoing.xit"
3435
}
3536
},
36-
"end": "\\n",
37-
"patterns": [
38-
{
39-
"include": "#description"
37+
"while": " (.+)",
38+
"whileCaptures": {
39+
"1": {
40+
"patterns": [
41+
{
42+
"include": "#item-description"
43+
}
44+
]
4045
}
41-
]
46+
}
4247
},
43-
"closed-items": {
44-
"begin": "^(?:(\\[x\\])|(\\[~\\]))(?= |$)",
48+
"closed-item": {
49+
"begin": "^(?:(\\[x\\])|(\\[~\\]))[^\\S\\n]*(.*(?= |$))",
4550
"beginCaptures": {
4651
"1": {
47-
"name": "markup.strikethrough.xit, markup.inserted.xit, markup.other.task.checkbox.checked.xit"
52+
"name": "markup.inserted.xit, markup.other.task.checkbox.checked.xit"
4853
},
4954
"2": {
50-
"name": "comment.xit, markup.strikethrough.xit, markup.other.task.checkbox.obsolete.xit"
55+
"name": "comment.xit, markup.other.task.checkbox.obsolete.xit"
56+
},
57+
"3": {
58+
"name": "comment.xit, markup.strikethrough.xit"
5159
}
5260
},
53-
"end": "\\n",
54-
"contentName": "comment.line.xit, markup.strikethrough.xit, markup.other.task.description.closed.xit",
55-
"patterns": [
56-
{
57-
"include": "#description"
61+
"while": " (.+)",
62+
"whileCaptures": {
63+
"1": {
64+
"name": "comment.xit, markup.strikethrough.xit",
65+
"patterns": [
66+
{
67+
"include": "#item-description"
68+
}
69+
]
5870
}
59-
]
71+
}
6072
},
61-
"description": {
73+
"item-description": {
6274
"patterns": [
63-
{
75+
{
6476
"match": "(?<=^\\[[ x@~]\\] )(?:(?:!+\\.*)|(?:\\.*!+))",
6577
"name": "markup.deleted.xit, markup.other.task.priority.xit"
6678
},

0 commit comments

Comments
 (0)