From f6555ce9b31dc0d839f93ee080ed7b4d2d62880e Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 25 May 2023 15:55:41 +0200 Subject: [PATCH] Include comment thread in command arguments (#183431) --- .../contrib/comments/browser/commentNode.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/comments/browser/commentNode.ts b/src/vs/workbench/contrib/comments/browser/commentNode.ts index e342d91241feb..6f3edc9f382f3 100644 --- a/src/vs/workbench/contrib/comments/browser/commentNode.ts +++ b/src/vs/workbench/contrib/comments/browser/commentNode.ts @@ -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 { + await action.run(...context); + } +} + export class CommentNode extends Disposable { private _domNode: HTMLElement; private _body: HTMLElement; @@ -249,11 +255,16 @@ export class CommentNode 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() { @@ -278,6 +289,7 @@ export class CommentNode extends Disposable { }); this.toolbar.context = this.commentNodeContext; + this.toolbar.actionRunner = new CommentsActionRunner(); this.registerActionBarListeners(this._actionsToolbarContainer); this._register(this.toolbar); @@ -679,7 +691,7 @@ export class CommentNode extends Disposable { menuId: MenuId.CommentThreadCommentContext, menuActionOptions: { shouldForwardArgs: true }, contextKeyService: this._contextKeyService, - actionRunner: new ActionRunner(), + actionRunner: new CommentsActionRunner(), getActionsContext: () => { return this.commentNodeContext; },