replace draft properties with labels in CommentThread and Comment

This commit is contained in:
Peng Lyu
2019-03-06 14:29:02 -08:00
parent 905248fa6e
commit ce1cb8a9fc
7 changed files with 71 additions and 8 deletions

View File

@@ -94,6 +94,20 @@ export class MainThreadCommentThread implements modes.CommentThread2 {
private _onDidChangeInput = new Emitter<modes.CommentInput | undefined>();
get onDidChangeInput(): Event<modes.CommentInput | undefined> { return this._onDidChangeInput.event; }
private _label: string;
get label(): string {
return this._label;
}
set label(label: string) {
this._label = label;
}
private _onDidChangeLabel = new Emitter<string>();
get onDidChangeLabel(): Event<string> { return this._onDidChangeLabel.event; }
public get comments(): modes.Comment[] {
return this._comments;
}
@@ -263,6 +277,11 @@ export class MainThreadCommentController {
thread.range = range;
}
updateCommentThreadLabel(commentThreadHandle: number, label: string) {
let thread = this._threads.get(commentThreadHandle);
thread.label = label;
}
updateInput(input: string) {
let thread = this.activeCommentThread;
@@ -445,6 +464,16 @@ export class MainThreadComments extends Disposable implements MainThreadComments
provider.updateCommentThreadRange(commentThreadHandle, range);
}
$updateCommentThreadLabel(handle: number, commentThreadHandle: number, label: string): void {
let provider = this._commentControllers.get(handle);
if (!provider) {
return;
}
provider.updateCommentThreadLabel(commentThreadHandle, label);
}
$registerDocumentCommentProvider(handle: number, features: CommentProviderFeatures): void {
this._documentProviders.set(handle, undefined);
const handler = new MainThreadDocumentCommentProvider(this._proxy, handle, features);

View File

@@ -127,6 +127,7 @@ export interface MainThreadCommentsShape extends IDisposable {
$updateCommentThreadCommands(handle: number, commentThreadHandle: number, acceptInputCommands: 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;
$registerDocumentCommentProvider(handle: number, features: CommentProviderFeatures): void;
$unregisterDocumentCommentProvider(handle: number): void;
$registerWorkspaceCommentProvider(handle: number, extensionId: ExtensionIdentifier): void;

View File

@@ -308,6 +308,17 @@ export class ExtHostCommentThread implements vscode.CommentThread {
return this._range;
}
private _label: string;
get label(): string {
return this._label;
}
set label(label: string) {
this._label = label;
this._proxy.$updateCommentThreadLabel(this._commentControlHandle, this.handle, this._label);
}
private _comments: vscode.Comment[] = [];
get comments(): vscode.Comment[] {
@@ -557,7 +568,8 @@ function convertToModeComment(vscodeComment: vscode.Comment, commandsConverter:
userIconPath: iconPath,
isDraft: vscodeComment.isDraft,
editCommand: vscodeComment.editCommand ? commandsConverter.toInternal(vscodeComment.editCommand) : undefined,
deleteCommand: vscodeComment.editCommand ? commandsConverter.toInternal(vscodeComment.deleteCommand) : undefined
deleteCommand: vscodeComment.editCommand ? commandsConverter.toInternal(vscodeComment.deleteCommand) : undefined,
label: vscodeComment.label
};
}