update comments in editor when a data provider is registered.

This commit is contained in:
Peng Lyu
2018-05-18 10:03:52 -07:00
parent b9368d81e8
commit 5d6cca6013
3 changed files with 44 additions and 17 deletions

View File

@@ -57,28 +57,27 @@ export class MainThreadComments extends Disposable implements MainThreadComments
this._commentService.setComments(outerEditorURI, commentInfos.filter(info => info !== null));
});
for (const handle of keys(this._documentProviders)) {
_commentService.registerDataProvider(
handle,
{
provideDocumentComments: async (uri, token) => {
return this._proxy.$provideDocumentComments(handle, uri);
},
onDidChangeCommentThreads: null,
createNewCommentThread: async (uri, range, text, token) => {
return this._proxy.$createNewCommentThread(handle, uri, range, text);
},
replyToCommentThread: async (uri, range, thread, text, token) => {
return this._proxy.$replyToCommentThread(handle, uri, range, thread, text);
}
}
);
}
});
}
$registerDocumentCommentProvider(handle: number): void {
this._documentProviders.set(handle, undefined);
this._commentService.registerDataProvider(
handle,
{
provideDocumentComments: async (uri, token) => {
return this._proxy.$provideDocumentComments(handle, uri);
},
onDidChangeCommentThreads: null,
createNewCommentThread: async (uri, range, text, token) => {
return this._proxy.$createNewCommentThread(handle, uri, range, text);
},
replyToCommentThread: async (uri, range, thread, text, token) => {
return this._proxy.$replyToCommentThread(handle, uri, range, thread, text);
}
}
);
}
$registerWorkspaceCommentProvider(handle: number): void {