Skip to content

Commit 9156e09

Browse files
committed
Hy: Continue comment cmd doesn't seem to be working
Fixes #11
1 parent 23f8adc commit 9156e09

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@
893893
{
894894
"command": "hy.continueComment",
895895
"key": "enter",
896-
"when": "hy:keybindingsEnabled && editorLangId = hy && editorTextfocus && hy:cursorInComment"
896+
"when": "hy:keybindingsEnabled && editorLangId == hy && editorTextFocus && hy:cursorInComment"
897897
},
898898
{
899899
"command": "hy.calva-fmt.formatCurrentForm",

src/cursor-doc/cdf-edits/hy-lexer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ toplevel.terminal(
6161
/[\f\u000B\u001C\u001D\u001E\u001F\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2008\u2009\u200a\u205f\u3000]+/,
6262
(l, m) => ({ type: 'ws' })
6363
);
64-
// comments -- 2022-07-06: Updated for hy comment syntax rather than Clojure (`#` instead of `;`)
65-
toplevel.terminal('comment', /#.*$/, (l, m) => ({ type: 'comment' }));
64+
// comments
65+
toplevel.terminal('comment', /;.*/, (l, m) => ({ type: 'comment' }));
6666
// Calva repl prompt, it contains special colon symbols and a hard space
6767
toplevel.terminal(
6868
'comment',

src/edit.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function continueCommentCommand() {
1919
}
2020
const commentOffset = cursor.rowCol[1];
2121
const commentText = cursor.getToken().raw;
22-
const [_1, startText, bullet, num] = commentText.match(/^([#\s]+)([*-] +|(\d+)\. +)?/) ?? [];
22+
const [_1, startText, bullet, num] = commentText.match(/^([;\s]+)([*-] +|(\d+)\. +)?/) ?? [];
2323
const newNum = num ? parseInt(num) + 1 : undefined;
2424
const bulletText = newNum ? bullet.replace(/\d+/, '' + newNum) : bullet;
2525
const pad = ' '.repeat(commentOffset);

src/hyMain.ts

+6
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ export function activate(context: vscode.ExtensionContext) {
171171
onDidChangeEditorOrSelection(editor);
172172
})
173173
);
174+
context.subscriptions.push(
175+
vscode.window.onDidChangeTextEditorSelection((editor) => {
176+
status.update();
177+
onDidChangeEditorOrSelection(editor.textEditor);
178+
})
179+
);
174180
context.subscriptions.push(
175181
vscode.workspace.onDidChangeTextDocument(annotations.onDidChangeTextDocument)
176182
);

0 commit comments

Comments
 (0)