Test out creating an editable thread

This commit is contained in:
Alex Ross
2024-06-18 11:08:15 +02:00
parent 36f0e08404
commit 4de748fb53
2 changed files with 14 additions and 0 deletions

View File

@ -22,6 +22,10 @@
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "mywiki.createByCommand",
"title": "Create Note from Command"
},
{
"command": "mywiki.createNote",
"title": "Create Note",

View File

@ -33,6 +33,16 @@ export function activate(context: vscode.ExtensionContext) {
}
};
context.subscriptions.push(vscode.commands.registerCommand('mywiki.createByCommand', () => {
const line = vscode.window.activeTextEditor?.selection.active.line;
if (line === undefined) {
return;
}
const thread = commentController.createCommentThread(vscode.window.activeTextEditor!.document.uri, new vscode.Range(line, 0, line, 0), [new NoteComment('', vscode.CommentMode.Editing, { name: 'vscode' })]);
thread.label = 'Test label';
thread.collapsibleState = vscode.CommentThreadCollapsibleState.Expanded;
}));
context.subscriptions.push(vscode.commands.registerCommand('mywiki.createNote', (reply: vscode.CommentReply) => {
replyNote(reply);
}));