Add provideAllComments method to comments provider

This commit is contained in:
Rachel Macfarlane
2018-04-16 17:10:25 -07:00
parent bb8e244a7f
commit 3a297dc5b4
11 changed files with 213 additions and 119 deletions

View File

@@ -50,8 +50,7 @@ export class MainThreadComments extends Disposable implements MainThreadComments
const outerEditorURI = outerEditor.getModel().uri;
this.provideComments(outerEditorURI).then(commentThreads => {
controller.setComments(commentThreads);
this._commentService.setCommentsForResource(outerEditorURI, commentThreads);
this._commentService.setComments(outerEditorURI, commentThreads);
});
this.provideNewCommentRange(outerEditor.getModel()).then(newActions => {
controller.setNewCommentActions(newActions);
@@ -61,11 +60,20 @@ export class MainThreadComments extends Disposable implements MainThreadComments
$registerCommentProvider(handle: number): void {
this._providers.set(handle, undefined);
this._panelService.setPanelEnablement(COMMENTS_PANEL_ID, true);
// Fetch all comments
this._proxy.$provideAllComments(handle).then(commentThreads => {
if (commentThreads) {
this._commentService.setAllComments(commentThreads);
this._panelService.setPanelEnablement(COMMENTS_PANEL_ID, true);
}
});
}
$unregisterCommentProvider(handle: number): void {
this._providers.delete(handle);
this._panelService.setPanelEnablement(COMMENTS_PANEL_ID, false);
}
dispose(): void {