diff --git a/comment-sample/package.json b/comment-sample/package.json index 8222811e..68f699f1 100644 --- a/comment-sample/package.json +++ b/comment-sample/package.json @@ -85,40 +85,39 @@ "when": "false" } ], - "commentThread/title": [ + "comments/commentThread/title": [ { "command": "mywiki.deleteNote", "group": "navigation", "when": "!commentThreadIsEmpty" } ], - "commentThread/actions": [ + "comments/commentThread/actions": [ { "command": "mywiki.createNote", - "precondition": "commentIsEmpty", "group": "navigation", + "precondition": "!commentIsEmpty", "when": "commentThreadIsEmpty" }, { "command": "mywiki.replyNote", - "precondition": "commentIsEmpty", "group": "navigation", + "precondition": "!commentIsEmpty", "when": "!commentThreadIsEmpty" }, { "command": "mywiki.startDraft", - "precondition": "commentIsEmpty", "group": "navigation", + "precondition": "!commentIsEmpty", "when": "!inDraft" }, { "command": "mywiki.finishDraft", - "precondition": "commentIsEmpty", "group": "navigation", "when": "inDraft" } ], - "comment/title": [ + "comments/comment/title": [ { "command": "mywiki.editNote", "group": "group@1" @@ -128,7 +127,7 @@ "group": "group@2" } ], - "comment/actions": [ + "comments/comment/actions": [ { "command": "mywiki.cancelsaveNote", "group": "group@1" diff --git a/comment-sample/src/extension.ts b/comment-sample/src/extension.ts index 752f64b9..9beb9f47 100644 --- a/comment-sample/src/extension.ts +++ b/comment-sample/src/extension.ts @@ -19,7 +19,7 @@ class NoteComment implements vscode.Comment { export function activate(context: vscode.ExtensionContext) { // A `CommentController` is able to provide comments for documents. - const commentController = vscode.comment.createCommentController('comment-sample', 'Comment API Sample'); + const commentController = vscode.comments.createCommentController('comment-sample', 'Comment API Sample'); context.subscriptions.push(commentController); vscode.commands.executeCommand('setContext', 'inDraft', false); @@ -30,15 +30,15 @@ export function activate(context: vscode.ExtensionContext) { return [new vscode.Range(0, 0, lineCount - 1, 0)]; } }; - + context.subscriptions.push(vscode.commands.registerCommand('mywiki.createNote', (reply: vscode.CommentReply) => { replyNote(reply); })); - + context.subscriptions.push(vscode.commands.registerCommand('mywiki.replyNote', (reply: vscode.CommentReply) => { replyNote(reply); })); - + context.subscriptions.push(vscode.commands.registerCommand('mywiki.startDraft', (reply: vscode.CommentReply) => { vscode.commands.executeCommand('setContext', 'inDraft', true); let thread = reply.thread; @@ -46,7 +46,7 @@ export function activate(context: vscode.ExtensionContext) { newComment.label = 'pending'; thread.comments = [...thread.comments, newComment]; })); - + context.subscriptions.push(vscode.commands.registerCommand('mywiki.finishDraft', (reply: vscode.CommentReply) => { vscode.commands.executeCommand('setContext', 'inDraft', false); @@ -57,11 +57,11 @@ export function activate(context: vscode.ExtensionContext) { return comment; }); })); - + context.subscriptions.push(vscode.commands.registerCommand('mywiki.deleteNoteComment', (comment: NoteComment) => { let thread = comment.parent; thread.comments = thread.comments.filter((cmt: NoteComment) => cmt.id !== comment.id); - + if (thread.comments.length === 0) { thread.dispose(); } @@ -70,33 +70,33 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(vscode.commands.registerCommand('mywiki.deleteNote', (thread: vscode.CommentThread) => { thread.dispose(); })); - + context.subscriptions.push(vscode.commands.registerCommand('mywiki.cancelsaveNote', (comment: NoteComment) => { comment.parent.comments = comment.parent.comments.map((cmt: NoteComment) => { - if (cmt.id === comment.id) { + if (cmt.id === comment.id) { cmt.mode = vscode.CommentMode.Preview; } - + return cmt; }); })); - + context.subscriptions.push(vscode.commands.registerCommand('mywiki.saveNote', (comment: NoteComment) => { comment.parent.comments = comment.parent.comments.map((cmt: NoteComment) => { - if (cmt.id === comment.id) { + if (cmt.id === comment.id) { cmt.mode = vscode.CommentMode.Preview; } - + return cmt; }); })); - + context.subscriptions.push(vscode.commands.registerCommand('mywiki.editNote', (comment: NoteComment) => { comment.parent.comments = comment.parent.comments.map((cmt: NoteComment) => { - if (cmt.id === comment.id) { + if (cmt.id === comment.id) { cmt.mode = vscode.CommentMode.Editing; } - + return cmt; }); })); diff --git a/comment-sample/src/typings/vscode.proposed.d.ts b/comment-sample/src/typings/vscode.proposed.d.ts index 22d0b905..308d5479 100644 --- a/comment-sample/src/typings/vscode.proposed.d.ts +++ b/comment-sample/src/typings/vscode.proposed.d.ts @@ -175,7 +175,7 @@ declare module 'vscode' { dispose(): void; } - namespace comment { + namespace comments { /** * Creates a new [comment controller](#CommentController) instance. *