Update command

This commit is contained in:
Peng Lyu
2019-03-07 11:13:17 -08:00
parent ebb19f7212
commit 2dd494062b
2 changed files with 28 additions and 22 deletions

View File

@ -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 = '';

View File

@ -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.