mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
Allow individual comments to be marked as draft (#173305)
* Allow individual comments to be marked as draft This is a proposal for #171166. * Remove `hasDraftComments` from `CommentThread` * Rename `CommentVisibility` to `CommentState` * Rename `CommentVisibility` to `CommentState` * Add api proposal check --------- Co-authored-by: Alex Ross <alros@microsoft.com>
This commit is contained in:
@@ -491,7 +491,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
|
||||
}
|
||||
if (modified('comments')) {
|
||||
formattedModifications.comments =
|
||||
this._comments.map(cmt => convertToDTOComment(this, cmt, this._commentsMap));
|
||||
this._comments.map(cmt => convertToDTOComment(this, cmt, this._commentsMap, this.extensionDescription));
|
||||
}
|
||||
if (modified('collapsibleState')) {
|
||||
formattedModifications.collapseState = convertToCollapsibleState(this._collapseState);
|
||||
@@ -666,13 +666,17 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
|
||||
}
|
||||
}
|
||||
|
||||
function convertToDTOComment(thread: ExtHostCommentThread, vscodeComment: vscode.Comment, commentsMap: Map<vscode.Comment, number>): CommentChanges {
|
||||
function convertToDTOComment(thread: ExtHostCommentThread, vscodeComment: vscode.Comment, commentsMap: Map<vscode.Comment, number>, extension: IExtensionDescription): CommentChanges {
|
||||
let commentUniqueId = commentsMap.get(vscodeComment)!;
|
||||
if (!commentUniqueId) {
|
||||
commentUniqueId = ++thread.commentHandle;
|
||||
commentsMap.set(vscodeComment, commentUniqueId);
|
||||
}
|
||||
|
||||
if (vscodeComment.state !== undefined) {
|
||||
checkProposedApiEnabled(extension, 'commentsDraftState');
|
||||
}
|
||||
|
||||
return {
|
||||
mode: vscodeComment.mode,
|
||||
contextValue: vscodeComment.contextValue,
|
||||
@@ -682,6 +686,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
|
||||
userIconPath: vscodeComment.author.iconPath,
|
||||
label: vscodeComment.label,
|
||||
commentReactions: vscodeComment.reactions ? vscodeComment.reactions.map(reaction => convertToReaction(reaction)) : undefined,
|
||||
state: vscodeComment.state,
|
||||
timestamp: vscodeComment.timestamp?.toJSON()
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user