mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-06-13 07:10:26 +08:00
Update command
This commit is contained in:
@ -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 = '';
|
||||
|
||||
12
comment-sample/src/typings/vscode.proposed.d.ts
vendored
12
comment-sample/src/typings/vscode.proposed.d.ts
vendored
@ -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.
|
||||
|
||||
Reference in New Issue
Block a user