Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include comment thread in command arguments #183431

Merged
merged 1 commit into from May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/vs/workbench/contrib/comments/browser/commentNode.ts
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