Include comment thread in command arguments (#183431)

This commit is contained in:
Alex Ross
2023-05-25 15:55:41 +02:00
committed by GitHub
parent 2c5f901887
commit f6555ce9b3
@@ -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;
@@ -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() {
@@ -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);
@@ -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;
},