Add active comment thread.

This commit is contained in:
Peng Lyu
2019-04-28 12:30:29 -07:00
parent accab2eaa7
commit 2884d2239b
4 changed files with 24 additions and 0 deletions

View File

@@ -458,6 +458,7 @@ export class MainThreadComments extends Disposable implements MainThreadComments
this._proxy.$onCommentWidgetInputChange(controller.handle, this._input ? this._input.value : undefined);
}));
await this._proxy.$onActiveCommentThreadChange(controller.handle, controller.activeCommentThread.commentThreadHandle);
await this._proxy.$onCommentWidgetInputChange(controller.handle, this._input ? this._input.value : undefined);
}));
}

View File

@@ -1203,6 +1203,7 @@ export interface ExtHostCommentsShape {
$provideDocumentComments(handle: number, document: UriComponents): Promise<modes.CommentInfo | null>;
$createNewCommentThread(handle: number, document: UriComponents, range: IRange, text: string): Promise<modes.CommentThread | null>;
$onCommentWidgetInputChange(commentControllerHandle: number, input: string | undefined): Promise<number | undefined>;
$onActiveCommentThreadChange(commentControllerHandle: number, threadHandle: number | undefined): Promise<number | undefined>;
$provideCommentingRanges(commentControllerHandle: number, uriComponents: UriComponents, token: CancellationToken): Promise<IRange[] | undefined>;
$provideReactionGroup(commentControllerHandle: number): Promise<modes.CommentReaction[] | undefined>;
$toggleReaction(commentControllerHandle: number, threadHandle: number, uri: UriComponents, comment: modes.Comment, reaction: modes.CommentReaction): Promise<void>;

View File

@@ -99,6 +99,17 @@ export class ExtHostComments implements ExtHostCommentsShape {
return Promise.resolve(commentControllerHandle);
}
$onActiveCommentThreadChange(commentControllerHandle: number, threadHandle: number): Promise<number | undefined> {
const commentController = this._commentControllers.get(commentControllerHandle);
if (!commentController) {
return Promise.resolve(undefined);
}
commentController.$onActiveCommentThreadChange(threadHandle);
return Promise.resolve(threadHandle);
}
$provideCommentingRanges(commentControllerHandle: number, uriComponents: UriComponents, token: CancellationToken): Promise<IRange[] | undefined> {
const commentController = this._commentControllers.get(commentControllerHandle);
@@ -563,6 +574,7 @@ class ExtHostCommentController implements vscode.CommentController {
}
public inputBox: ExtHostCommentInputBox | undefined;
public activeCommentThread: ExtHostCommentThread | undefined;
public activeCommentingRange?: vscode.Range;
public get handle(): number {
@@ -610,6 +622,10 @@ class ExtHostCommentController implements vscode.CommentController {
}
}
$onActiveCommentThreadChange(threadHandle: number) {
this.activeCommentThread = this.getCommentThread(threadHandle);
}
getCommentThread(handle: number) {
return this._threads.get(handle);
}