mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
Test out creating an editable thread
This commit is contained in:
@ -22,6 +22,10 @@
|
||||
"main": "./out/extension.js",
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "mywiki.createByCommand",
|
||||
"title": "Create Note from Command"
|
||||
},
|
||||
{
|
||||
"command": "mywiki.createNote",
|
||||
"title": "Create Note",
|
||||
|
||||
@ -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);
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user