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

Fixes https://github.com/microsoft/monaco-editor/issues/2547 #176504

Merged
merged 2 commits into from Mar 10, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/vs/editor/browser/widget/codeEditorWidget.ts
Expand Up @@ -1083,7 +1083,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE

const action = this.getAction(handlerId);
if (action) {
Promise.resolve(action.run()).then(undefined, onUnexpectedError);
Promise.resolve(action.run(payload)).then(undefined, onUnexpectedError);
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/vs/editor/common/editorAction.ts
Expand Up @@ -13,7 +13,7 @@ export class InternalEditorAction implements IEditorAction {
public readonly alias: string;

private readonly _precondition: ContextKeyExpression | undefined;
private readonly _run: () => Promise<void>;
private readonly _run: (args: unknown) => Promise<void>;
private readonly _contextKeyService: IContextKeyService;

constructor(
Expand All @@ -36,11 +36,11 @@ export class InternalEditorAction implements IEditorAction {
return this._contextKeyService.contextMatchesRules(this._precondition);
}

public run(): Promise<void> {
public run(args: unknown): Promise<void> {
if (!this.isSupported()) {
return Promise.resolve(undefined);
}

return this._run();
return this._run(args);
}
}
2 changes: 1 addition & 1 deletion src/vs/editor/common/editorCommon.ts
Expand Up @@ -150,7 +150,7 @@ export interface IEditorAction {
readonly label: string;
readonly alias: string;
isSupported(): boolean;
run(): Promise<void>;
run(args?: unknown): Promise<void>;
}

export type IEditorModel = ITextModel | IDiffEditorModel;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/monaco.d.ts
Expand Up @@ -2478,7 +2478,7 @@ declare namespace monaco.editor {
readonly label: string;
readonly alias: string;
isSupported(): boolean;
run(): Promise<void>;
run(args?: unknown): Promise<void>;
}

export type IEditorModel = ITextModel | IDiffEditorModel;
Expand Down