Use customized toolbar for reactions.

This commit is contained in:
Peng Lyu
2019-02-13 12:07:28 -08:00
parent b819c7668e
commit 1789af2b83
10 changed files with 197 additions and 37 deletions

View File

@@ -250,7 +250,13 @@ function convertFromComment(comment: modes.Comment): vscode.Comment {
canEdit: comment.canEdit,
canDelete: comment.canDelete,
isDraft: comment.isDraft,
commentReactions: comment.commentReactions
commentReactions: comment.commentReactions ? comment.commentReactions.map(reaction => {
return {
label: reaction.label,
count: reaction.count,
hasReacted: reaction.hasReacted
};
}) : undefined
};
}
@@ -273,6 +279,8 @@ function convertToComment(provider: vscode.DocumentCommentProvider | vscode.Work
commentReactions: vscodeComment.commentReactions ? vscodeComment.commentReactions.map(reaction => {
return {
label: reaction.label,
iconPath: reaction.iconPath ? extHostTypeConverter.pathOrURIToURI(reaction.iconPath) : undefined,
count: reaction.count,
hasReacted: reaction.hasReacted,
canEdit: (reaction.hasReacted && providerCanDeleteReaction) || (!reaction.hasReacted && providerCanAddReaction)
};

View File

@@ -311,7 +311,7 @@ export function fromRangeOrRangeWithMessage(ranges: vscode.Range[] | vscode.Deco
}
}
function pathOrURIToURI(value: string | URI): URI {
export function pathOrURIToURI(value: string | URI): URI {
if (typeof value === 'undefined') {
return value;
}