提交 528b422d 编写于 作者: P Peng Lyu

strict null checks

上级 58961de8
...@@ -120,7 +120,7 @@ export class ExtHostComments implements ExtHostCommentsShape { ...@@ -120,7 +120,7 @@ export class ExtHostComments implements ExtHostCommentsShape {
} }
return asPromise(() => { return asPromise(() => {
return commentController.reactionProvider.availableReactions; return commentController!.reactionProvider!.availableReactions;
}).then(reactions => reactions.map(reaction => convertToReaction2(commentController.reactionProvider, reaction))); }).then(reactions => reactions.map(reaction => convertToReaction2(commentController.reactionProvider, reaction)));
} }
...@@ -136,7 +136,10 @@ export class ExtHostComments implements ExtHostCommentsShape { ...@@ -136,7 +136,10 @@ export class ExtHostComments implements ExtHostCommentsShape {
const commentThread = commentController.getCommentThread(threadHandle); const commentThread = commentController.getCommentThread(threadHandle);
if (commentThread) { if (commentThread) {
const vscodeComment = commentThread.getComment(comment.commentId); const vscodeComment = commentThread.getComment(comment.commentId);
return commentController.reactionProvider.toggleReaction(document, vscodeComment, convertFromReaction(reaction));
if (commentController !== undefined && commentController.reactionProvider && commentController.reactionProvider.toggleReaction && vscodeComment) {
return commentController.reactionProvider.toggleReaction(document, vscodeComment, convertFromReaction(reaction));
}
} }
return Promise.resolve(undefined); return Promise.resolve(undefined);
...@@ -519,13 +522,15 @@ class ExtHostCommentController implements vscode.CommentController { ...@@ -519,13 +522,15 @@ class ExtHostCommentController implements vscode.CommentController {
private _commentReactionProvider?: vscode.CommentReactionProvider; private _commentReactionProvider?: vscode.CommentReactionProvider;
get reactionProvider() { get reactionProvider(): vscode.CommentReactionProvider | undefined {
return this._commentReactionProvider; return this._commentReactionProvider;
} }
set reactionProvider(provider: vscode.CommentReactionProvider) { set reactionProvider(provider: vscode.CommentReactionProvider | undefined) {
this._commentReactionProvider = provider; this._commentReactionProvider = provider;
this._proxy.$updateCommentControllerFeatures(this.handle, { reactionGroup: provider.availableReactions.map(reaction => convertToReaction2(provider, reaction)) }); if (provider) {
this._proxy.$updateCommentControllerFeatures(this.handle, { reactionGroup: provider.availableReactions.map(reaction => convertToReaction2(provider, reaction)) });
}
} }
constructor( constructor(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册