From 2dd494062b6eaee5b79d8356dc2417542fa51e11 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Thu, 7 Mar 2019 11:13:17 -0800 Subject: [PATCH] Update command --- comment-sample/src/extension.ts | 38 +++++++++---------- .../src/typings/vscode.proposed.d.ts | 12 +++++- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/comment-sample/src/extension.ts b/comment-sample/src/extension.ts index 4bb53c88..2c5d3f2a 100644 --- a/comment-sample/src/extension.ts +++ b/comment-sample/src/extension.ts @@ -27,17 +27,15 @@ export function activate(context: vscode.ExtensionContext) { thread.label = 'Create New Note'; // We will render all `acceptInputCommands` as Actions on the bottom of Comment Widget in the editor. - thread.acceptInputCommands = [ - { - title: 'Create Note', - command: 'mywiki.createNote', - // Command is responsible for arguments - arguments: [ - commentController, - thread - ] - } - ]; + thread.acceptInputCommand = { + title: 'Create Note', + command: 'mywiki.createNote', + // Command is responsible for arguments + arguments: [ + commentController, + thread + ] + }; }; // Register commenting range provider and callback. @@ -55,16 +53,14 @@ export function activate(context: vscode.ExtensionContext) { thread.label = 'Participants: vscode'; // After we create the new comment thread, we may want to update the actions on the Comment Widget. - thread.acceptInputCommands = [ - { - title: 'Create Comment', - command: 'mywiki.createComment', - arguments: [ - commentController, - thread - ] - } - ]; + thread.acceptInputCommand = { + title: 'Create Comment', + command: 'mywiki.createComment', + arguments: [ + commentController, + thread + ] + }; // Lastly, we want to clear the textarea in Comment Widget. commentController.inputBox.value = ''; diff --git a/comment-sample/src/typings/vscode.proposed.d.ts b/comment-sample/src/typings/vscode.proposed.d.ts index 522dce06..85c9ab6e 100644 --- a/comment-sample/src/typings/vscode.proposed.d.ts +++ b/comment-sample/src/typings/vscode.proposed.d.ts @@ -55,7 +55,17 @@ declare module 'vscode' { * The ordered comments of the thread. */ comments: Comment[]; - acceptInputCommands?: Command[]; + /** + * `acceptInputCommand` is the default action rendered on Comment Widget, which is always placed rightmost. + * It will be executed when users submit the comment from keyboard shortcut. + * This action is disabled when the comment editor is empty. + */ + acceptInputCommand?: Command; + + /** + * `additionalCommands` are the secondary actions rendered on Comment Widget. + */ + additionalCommands?: Command[]; /** * Whether the thread should be collapsed or expanded when opening the document. Defaults to Collapsed.