edit/delete command

This commit is contained in:
Peng Lyu
2019-02-20 16:45:50 -08:00
parent 38e0c3f2c2
commit de52daea94
7 changed files with 78 additions and 32 deletions

View File

@@ -1097,7 +1097,7 @@ export interface ExtHostProgressShape {
export interface ExtHostCommentsShape {
$provideDocumentComments(handle: number, document: UriComponents): Promise<modes.CommentInfo>;
$createNewCommentThread(handle: number, document: UriComponents, range: IRange, text: string): Promise<modes.CommentThread>;
$onActiveCommentWidgetChange(commentControlhandle: number, commentThread: modes.CommentThread, comment: modes.Comment | undefined, input: string): Promise<void>;
$onActiveCommentWidgetChange(commentControlhandle: number, commentThread: modes.CommentThread2, comment: modes.Comment | undefined, input: string): Promise<number | undefined>;
$onCommentWidgetInputChange(commentControlhandle: number, value: string): Promise<void>;
$replyToCommentThread(handle: number, document: UriComponents, range: IRange, commentThread: modes.CommentThread, text: string): Promise<modes.CommentThread>;
$editComment(handle: number, document: UriComponents, comment: modes.Comment, text: string): Promise<void>;

View File

@@ -51,7 +51,7 @@ export class ExtHostComments implements ExtHostCommentsShape {
if (!commentControl) {
return arg;
}
}
return commentControl;
} else if (arg && arg.$mid === 7) {
@@ -347,7 +347,7 @@ export class ExtHostCommentThread implements vscode.CommentThread {
this._commentControlHandle,
this.handle
);
}
}
}
export class ExtHostCommentWidget implements vscode.CommentWidget {
@@ -498,7 +498,7 @@ function convertFromComment(comment: modes.Comment): vscode.Comment {
};
}
function convertToModeComment(vscodeComment: vscode.Comment): modes.Comment {
function convertToModeComment(vscodeComment: vscode.Comment, commandsConverter: CommandsConverter): modes.Comment {
const iconPath = vscodeComment.userIconPath ? vscodeComment.userIconPath.toString() : vscodeComment.gravatar;
return {
@@ -506,7 +506,9 @@ function convertToModeComment(vscodeComment: vscode.Comment): modes.Comment {
body: extHostTypeConverter.MarkdownString.from(vscodeComment.body),
userName: vscodeComment.userName,
userIconPath: iconPath,
isDraft: vscodeComment.isDraft
isDraft: vscodeComment.isDraft,
editCommand: vscodeComment.editCommand ? commandsConverter.toInternal(vscodeComment.editCommand) : undefined,
deleteCommand: vscodeComment.editCommand ? commandsConverter.toInternal(vscodeComment.deleteCommand) : undefined
};
}