Skip to content

Commit 73eafcd

Browse files
feat: add support for in question task items (#13)
Co-authored-by: patricktisdel <124397396+patricktisdel@users.noreply.github.com>
1 parent 1de6414 commit 73eafcd

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ If the colors and looks of the syntax highlighting is not correct or as fancy as
2525
// - markup.other.task.checkbox.ongoing.xit
2626
// - markup.other.task.checkbox.checked.xit
2727
// - markup.other.task.checkbox.obsolete.xit
28+
// - markup.other.task.checkbox.inquestion.xit
2829
// - markup.other.task.description.closed.xit
2930
// - markup.other.task.priority.xit
3031
// - markup.other.task.date.xit
@@ -76,3 +77,4 @@ The extension provides shortcuts for toggling/shuffling checkbox state. The shor
7677
- `a`/`@` - Ongoing (`[@] `)
7778
- `o`/`~` - Obsolete (`[~] `)
7879
- `x` - Checked (`[x] `)
80+
- `q` - Question (`[?] `)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "xit",
33
"displayName": "xit!",
44
"description": "Language support for todo lists with xit syntax.",
5-
"version": "0.0.4",
5+
"version": "0.0.5",
66
"publisher": "tscpp",
77
"repository": "https://github.com/tscpp/xit-vscode",
88
"engines": {

snippets.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
"prefix": "@",
1919
"body": ["[@] $1"],
2020
"description": "Ongoing item"
21+
},
22+
"In Question Item (?)": {
23+
"prefix": "q",
24+
"body": ["[?] $1"],
25+
"description": "In Question item"
2126
},
2227
"Obsolete Item (o)": {
2328
"prefix": "o",

src/extension.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function activate(context: vscode.ExtensionContext) {
4848
const editor = vscode.window.activeTextEditor!;
4949

5050
editSelectedCheckboxes(editor, (value) => {
51-
return /^\s*$/.test(value) ? 'x' : ' ';
51+
return /^(\s*|\?)$/.test(value) ? 'x' : ' ';
5252
});
5353
}));
5454

@@ -59,10 +59,11 @@ export function activate(context: vscode.ExtensionContext) {
5959
const edit =
6060
/* 1. " " -> "@" */ /^\s*$/.test(value) ? '@' :
6161
/* 2. "@" -> "~" */ value === '@' ? '~' :
62-
/* 3. "~" -> "x" */ value === '~' ? 'x' :
62+
/* 3. "~" -> "?" */ value === '~' ? '?' :
63+
/* 3. "?" -> "x" */ value === '?' ? 'x' :
6364
/* 4. "x" -> " " */ value === 'x' ? ' '
6465
/* fallback */ : ' ';
65-
66+
6667
return edit;
6768
});
6869
}));

syntaxes/xit.tmLanguage.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
]
2626
},
2727
"open-item": {
28-
"begin": "^(?:(\\[ *\\])|(\\[@\\]))[^\\S\\n]*(.*(?= |$))",
28+
"begin": "^(?:(\\[ *\\])|(\\[@\\])|(\\[\\?\\]))[^\\S\\n]*(.*(?= |$))",
2929
"beginCaptures": {
3030
"1": {
3131
"name": "variable.function.xit, markup.other.task.checkbox.open.xit"
@@ -34,6 +34,9 @@
3434
"name": "storage.type.xit, markup.other.task.checkbox.ongoing.xit"
3535
},
3636
"3": {
37+
"name": "entity.name.type.enum.xit, markup.other.task.checkbox.ongoing.xit"
38+
},
39+
"4": {
3740
"patterns": [
3841
{
3942
"include": "#item-description"

0 commit comments

Comments
 (0)