dispose empty comment thread when collapse.

This commit is contained in:
Peng Lyu
2019-05-23 16:37:33 -07:00
parent a9e31b19d7
commit 346da6b01a
5 changed files with 36 additions and 0 deletions

View File

@@ -366,6 +366,14 @@ export class MainThreadCommentController {
thread.dispose();
}
deleteCommentThreadMain(commentThreadId: string) {
this._threads.forEach(thread => {
if (thread.threadId === commentThreadId) {
this._proxy.$deleteCommentThread(this._handle, thread.commentThreadHandle);
}
});
}
updateInput(input: string) {
let thread = this.activeCommentThread;

View File

@@ -1210,6 +1210,7 @@ export interface ExtHostCommentsShape {
$createNewCommentThread(handle: number, document: UriComponents, range: IRange, text: string): Promise<modes.CommentThread | null>;
$createCommentThreadTemplate(commentControllerHandle: number, uriComponents: UriComponents, range: IRange): void;
$onCommentWidgetInputChange(commentControllerHandle: number, document: UriComponents, range: IRange, input: string | undefined): Promise<number | undefined>;
$deleteCommentThread(commentControllerHandle: number, commentThreadHandle: number): void;
$provideCommentingRanges(commentControllerHandle: number, uriComponents: UriComponents, token: CancellationToken): Promise<IRange[] | undefined>;
$checkStaticContribution(commentControllerHandle: number): Promise<boolean>;
$provideReactionGroup(commentControllerHandle: number): Promise<modes.CommentReaction[] | undefined>;

View File

@@ -173,6 +173,14 @@ export class ExtHostComments implements ExtHostCommentsShape {
return Promise.resolve(commentControllerHandle);
}
$deleteCommentThread(commentControllerHandle: number, commentThreadHandle: number) {
const commentController = this._commentControllers.get(commentControllerHandle);
if (commentController) {
commentController.$deleteCommentThread(commentThreadHandle);
}
}
$provideCommentingRanges(commentControllerHandle: number, uriComponents: UriComponents, token: CancellationToken): Promise<IRange[] | undefined> {
const commentController = this._commentControllers.get(commentControllerHandle);
@@ -764,6 +772,16 @@ class ExtHostCommentController implements vscode.CommentController {
return commentThread;
}
$deleteCommentThread(threadHandle: number) {
let thread = this._threads.get(threadHandle);
if (thread) {
thread.dispose();
}
this._threads.delete(threadHandle);
}
$onCommentWidgetInputChange(uriComponents: UriComponents, range: IRange, input: string) {
if (!this.inputBox) {
this.inputBox = new ExtHostCommentInputBox(this._proxy, this.handle, URI.revive(uriComponents), extHostTypeConverter.Range.to(range), input);