Skip to content

Commit

Permalink
Include comment thread in command arguments (#183431)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexr00 committed May 25, 2023
1 parent 2c5f901 commit f6555ce
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/vs/workbench/contrib/comments/browser/commentNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ import { DomEmitter } from 'vs/base/browser/event';
import { CommentContextKeys } from 'vs/workbench/contrib/comments/common/commentContextKeys';
import { FileAccess } from 'vs/base/common/network';

class CommentsActionRunner extends ActionRunner {
protected override async runAction(action: IAction, context: any[]): Promise<void> {
await action.run(...context);
}
}

export class CommentNode<T extends IRange | ICellRange> extends Disposable {
private _domNode: HTMLElement;
private _body: HTMLElement;
Expand Down Expand Up @@ -249,11 +255,16 @@ export class CommentNode<T extends IRange | ICellRange> extends Disposable {
}

private get commentNodeContext() {
return {
return [{
thread: this.commentThread,
commentUniqueId: this.comment.uniqueIdInThread,
$mid: MarshalledId.CommentNode
};
},
{
commentControlHandle: this.commentThread.controllerHandle,
commentThreadHandle: this.commentThread.commentThreadHandle,
$mid: MarshalledId.CommentThread
}];
}

private createToolbar() {
Expand All @@ -278,6 +289,7 @@ export class CommentNode<T extends IRange | ICellRange> extends Disposable {
});

this.toolbar.context = this.commentNodeContext;
this.toolbar.actionRunner = new CommentsActionRunner();

this.registerActionBarListeners(this._actionsToolbarContainer);
this._register(this.toolbar);
Expand Down Expand Up @@ -679,7 +691,7 @@ export class CommentNode<T extends IRange | ICellRange> extends Disposable {
menuId: MenuId.CommentThreadCommentContext,
menuActionOptions: { shouldForwardArgs: true },
contextKeyService: this._contextKeyService,
actionRunner: new ActionRunner(),
actionRunner: new CommentsActionRunner(),
getActionsContext: () => {
return this.commentNodeContext;
},
Expand Down

0 comments on commit f6555ce

Please sign in to comment.