Skip to content

Commit

Permalink
Add context menu to comments in comments panel to un/resolve conversa…
Browse files Browse the repository at this point in the history
…tion

Part of #206898
  • Loading branch information
alexr00 committed Mar 7, 2024
1 parent 1517ee8 commit e2da9fe
Show file tree
Hide file tree
Showing 17 changed files with 353 additions and 207 deletions.
2 changes: 1 addition & 1 deletion src/vs/editor/common/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ export interface PendingCommentThread {
body: string;
range: IRange | undefined;
uri: URI;
owner: string;
uniqueOwner: string;
isReply: boolean;
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7838,7 +7838,7 @@ declare namespace monaco.languages {
body: string;
range: IRange | undefined;
uri: Uri;
owner: string;
uniqueOwner: string;
isReply: boolean;
}

Expand Down
1 change: 1 addition & 0 deletions src/vs/platform/actions/common/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export class MenuId {
static readonly CommentThreadCommentContext = new MenuId('CommentThreadCommentContext');
static readonly CommentTitle = new MenuId('CommentTitle');
static readonly CommentActions = new MenuId('CommentActions');
static readonly CommentsViewThreadActions = new MenuId('CommentsViewThreadActions');
static readonly InteractiveToolbar = new MenuId('InteractiveToolbar');
static readonly InteractiveCellTitle = new MenuId('InteractiveCellTitle');
static readonly InteractiveCellDelete = new MenuId('InteractiveCellDelete');
Expand Down
12 changes: 8 additions & 4 deletions src/vs/workbench/api/browser/mainThreadComments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ export class MainThreadCommentController implements ICommentController {
return this._features;
}

get owner() {
return this._id;
}

constructor(
private readonly _proxy: ExtHostCommentsShape,
private readonly _commentService: ICommentService,
Expand Down Expand Up @@ -385,7 +389,7 @@ export class MainThreadCommentController implements ICommentController {
async getDocumentComments(resource: URI, token: CancellationToken) {
if (resource.scheme === Schemas.vscodeNotebookCell) {
return {
owner: this._uniqueId,
uniqueOwner: this._uniqueId,
label: this.label,
threads: [],
commentingRanges: {
Expand All @@ -407,7 +411,7 @@ export class MainThreadCommentController implements ICommentController {
const commentingRanges = await this._proxy.$provideCommentingRanges(this.handle, resource, token);

return <ICommentInfo>{
owner: this._uniqueId,
uniqueOwner: this._uniqueId,
label: this.label,
threads: ret,
commentingRanges: {
Expand All @@ -421,7 +425,7 @@ export class MainThreadCommentController implements ICommentController {
async getNotebookComments(resource: URI, token: CancellationToken) {
if (resource.scheme !== Schemas.vscodeNotebookCell) {
return <INotebookCommentInfo>{
owner: this._uniqueId,
uniqueOwner: this._uniqueId,
label: this.label,
threads: []
};
Expand All @@ -436,7 +440,7 @@ export class MainThreadCommentController implements ICommentController {
}

return <INotebookCommentInfo>{
owner: this._uniqueId,
uniqueOwner: this._uniqueId,
label: this.label,
threads: ret
};
Expand Down
138 changes: 70 additions & 68 deletions src/vs/workbench/contrib/comments/browser/commentService.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
private _contextKeyService: IContextKeyService;
private _scopedInstantiationService: IInstantiationService;

public get owner(): string {
return this._owner;
public get uniqueOwner(): string {
return this._uniqueOwner;
}
public get commentThread(): languages.CommentThread {
return this._commentThread;
Expand All @@ -120,7 +120,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget

constructor(
editor: ICodeEditor,
private _owner: string,
private _uniqueOwner: string,
private _commentThread: languages.CommentThread,
private _pendingComment: string | undefined,
private _pendingEdits: { [key: number]: string } | undefined,
Expand All @@ -137,7 +137,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
[IContextKeyService, this._contextKeyService]
));

const controller = this.commentService.getCommentController(this._owner);
const controller = this.commentService.getCommentController(this._uniqueOwner);
if (controller) {
this._commentOptions = controller.options;
}
Expand Down Expand Up @@ -229,7 +229,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
CommentThreadWidget,
container,
this.editor,
this._owner,
this._uniqueOwner,
this.editor.getModel()!.uri,
this._contextKeyService,
this._scopedInstantiationService,
Expand Down Expand Up @@ -258,7 +258,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
} else {
range = new Range(originalRange.startLineNumber, originalRange.startColumn, originalRange.endLineNumber, originalRange.endColumn);
}
await this.commentService.updateCommentThreadTemplate(this.owner, this._commentThread.commentThreadHandle, range);
await this.commentService.updateCommentThreadTemplate(this.uniqueOwner, this._commentThread.commentThreadHandle, range);
}
}
},
Expand All @@ -281,7 +281,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget

private deleteCommentThread(): void {
this.dispose();
this.commentService.disposeCommentThread(this.owner, this._commentThread.threadId);
this.commentService.disposeCommentThread(this.uniqueOwner, this._commentThread.threadId);
}

public collapse() {
Expand Down
Loading

0 comments on commit e2da9fe

Please sign in to comment.