Skip to content

Commit 51396e6

Browse files
committed
Allow individual comments to be marked as draft
This is a proposal for microsoft#171166.
1 parent e282742 commit 51396e6

File tree

7 files changed

+44
-0
lines changed

7 files changed

+44
-0
lines changed

src/vs/editor/common/languages.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1629,6 +1629,14 @@ export enum CommentMode {
16291629
Preview = 1
16301630
}
16311631

1632+
/**
1633+
* @internal
1634+
*/
1635+
export enum CommentVisibility {
1636+
Published = 0,
1637+
Draft = 1
1638+
}
1639+
16321640
/**
16331641
* @internal
16341642
*/

src/vs/workbench/api/common/extHost.api.impl.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
12431243
ColorPresentation: extHostTypes.ColorPresentation,
12441244
ColorThemeKind: extHostTypes.ColorThemeKind,
12451245
CommentMode: extHostTypes.CommentMode,
1246+
CommentVisibility: extHostTypes.CommentVisibility,
12461247
CommentThreadCollapsibleState: extHostTypes.CommentThreadCollapsibleState,
12471248
CommentThreadState: extHostTypes.CommentThreadState,
12481249
CompletionItem: extHostTypes.CompletionItem,

src/vs/workbench/api/common/extHost.protocol.ts

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export interface CommentChanges {
117117
readonly commentReactions?: languages.CommentReaction[];
118118
readonly label?: string;
119119
readonly mode?: languages.CommentMode;
120+
readonly visibility?: languages.CommentVisibility;
120121
readonly timestamp?: string;
121122
}
122123

src/vs/workbench/api/common/extHostComments.ts

+6
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
346346
this._onDidUpdateCommentThread.fire();
347347
}
348348

349+
get hasDraftComments(): boolean {
350+
return this._comments.some(comment => comment.visibility === types.CommentVisibility.Draft);
351+
}
352+
349353
private _localDisposables: types.Disposable[];
350354

351355
private _isDiposed: boolean;
@@ -418,6 +422,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
418422
set canReply(state: boolean) { that.canReply = state; },
419423
get contextValue() { return that.contextValue; },
420424
set contextValue(value: string | undefined) { that.contextValue = value; },
425+
get hasDraftComments() { return that.hasDraftComments; },
421426
get label() { return that.label; },
422427
set label(value: string | undefined) { that.label = value; },
423428
get state() { return that.state; },
@@ -662,6 +667,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
662667
userIconPath: iconPath,
663668
label: vscodeComment.label,
664669
commentReactions: vscodeComment.reactions ? vscodeComment.reactions.map(reaction => convertToReaction(reaction)) : undefined,
670+
visibility: vscodeComment.visibility,
665671
timestamp: vscodeComment.timestamp?.toJSON()
666672
};
667673
}

src/vs/workbench/api/common/extHostTypes.ts

+5
Original file line numberDiff line numberDiff line change
@@ -3046,6 +3046,11 @@ export enum CommentMode {
30463046
Preview = 1
30473047
}
30483048

3049+
export enum CommentVisibility {
3050+
Published = 0,
3051+
Draft = 1
3052+
}
3053+
30493054
export enum CommentThreadState {
30503055
Unresolved = 0,
30513056
Resolved = 1

src/vs/workbench/services/extensions/common/extensionsApiProposals.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
export const allApiProposals = Object.freeze({
99
authSession: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSession.d.ts',
1010
codiconDecoration: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codiconDecoration.d.ts',
11+
commentsDraftState: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentsDraftState.d.ts',
1112
contribCommentEditorActionsMenu: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentEditorActionsMenu.d.ts',
1213
contribCommentPeekContext: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentPeekContext.d.ts',
1314
contribCommentThreadAdditionalMenu: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
declare module 'vscode' {
7+
8+
// https://github.com/microsoft/vscode/issues/171166
9+
10+
export enum CommentVisibility {
11+
Published = 0,
12+
Draft = 1
13+
}
14+
15+
export interface Comment {
16+
visibility?: CommentVisibility;
17+
}
18+
19+
export interface CommentThread {
20+
readonly hasDraftComments: boolean;
21+
}
22+
}

0 commit comments

Comments
 (0)