Add a command for deleting comment threads

This commit is contained in:
Rachel Macfarlane
2019-03-18 16:27:18 -07:00
parent 37cb23d3dd
commit 30b2c30706
6 changed files with 78 additions and 8 deletions

View File

@@ -123,12 +123,13 @@ export interface MainThreadCommentsShape extends IDisposable {
$registerCommentController(handle: number, id: string, label: string): void;
$unregisterCommentController(handle: number): void;
$updateCommentControllerFeatures(handle: number, features: CommentProviderFeatures): void;
$createCommentThread(handle: number, commentThreadHandle: number, threadId: string, resource: UriComponents, range: IRange, comments: modes.Comment[], acceptInputCommand: modes.Command | undefined, additionalCommands: modes.Command[], collapseState: modes.CommentThreadCollapsibleState): modes.CommentThread2 | undefined;
$createCommentThread(handle: number, commentThreadHandle: number, threadId: string, resource: UriComponents, range: IRange, comments: modes.Comment[], acceptInputCommand: modes.Command | undefined, additionalCommands: modes.Command[], deleteCommand: modes.Command | undefined, collapseState: modes.CommentThreadCollapsibleState): modes.CommentThread2 | undefined;
$deleteCommentThread(handle: number, commentThreadHandle: number): void;
$updateComments(handle: number, commentThreadHandle: number, comments: modes.Comment[]): void;
$setInputValue(handle: number, input: string): void;
$updateCommentThreadAcceptInputCommand(handle: number, commentThreadHandle: number, acceptInputCommand: modes.Command): void;
$updateCommentThreadAdditionalCommands(handle: number, commentThreadHandle: number, additionalCommands: modes.Command[]): void;
$updateCommentThreadDeleteCommand(handle: number, commentThreadHandle: number, deleteCommand: modes.Command): void;
$updateCommentThreadCollapsibleState(handle: number, commentThreadHandle: number, collapseState: modes.CommentThreadCollapsibleState): void;
$updateCommentThreadRange(handle: number, commentThreadHandle: number, range: IRange): void;
$updateCommentThreadLabel(handle: number, commentThreadHandle: number, label: string): void;

View File

@@ -415,6 +415,18 @@ export class ExtHostCommentThread implements vscode.CommentThread {
this._proxy.$updateCommentThreadAdditionalCommands(this._commentController.handle, this.handle, internals);
}
private _deleteCommand?: vscode.Command;
get deleteComand(): vscode.Command | undefined {
return this._deleteCommand;
}
set deleteCommand(deleteCommand: vscode.Command) {
this._deleteCommand = deleteCommand;
const internal = this._commandsConverter.toInternal(deleteCommand);
this._proxy.$updateCommentThreadDeleteCommand(this._commentController.handle, this.handle, internal);
}
private _collapseState?: vscode.CommentThreadCollapsibleState;
get collapsibleState(): vscode.CommentThreadCollapsibleState {
@@ -444,6 +456,7 @@ export class ExtHostCommentThread implements vscode.CommentThread {
this._comments.map(comment => { return convertToModeComment(this._commentController, comment, this._commandsConverter); }),
this._acceptInputCommand ? this._commandsConverter.toInternal(this._acceptInputCommand) : undefined,
this._additionalCommands ? this._additionalCommands.map(x => this._commandsConverter.toInternal(x)) : [],
this._deleteCommand ? this._commandsConverter.toInternal(this._deleteCommand) : undefined,
this._collapseState!
);
}