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

aux window - fix action context for move/copy #199797

Merged
merged 1 commit into from
Dec 1, 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
24 changes: 11 additions & 13 deletions src/vs/workbench/browser/parts/editor/editorActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ export class ToggleMaximizeEditorGroupAction extends Action2 {

override async run(accessor: ServicesAccessor, resourceOrContext?: URI | IEditorCommandsContext, context?: IEditorCommandsContext): Promise<void> {
const editorGroupsService = accessor.get(IEditorGroupsService);

const { group } = resolveCommandsContext(editorGroupsService, getCommandsContext(resourceOrContext, context));
editorGroupsService.toggleMaximizeGroup(group);
}
Expand Down Expand Up @@ -2503,24 +2504,21 @@ abstract class BaseMoveCopyEditorToNewWindowAction extends Action2 {
});
}

override async run(accessor: ServicesAccessor): Promise<void> {
const editorService = accessor.get(IEditorService);
override async run(accessor: ServicesAccessor, resourceOrContext?: URI | IEditorCommandsContext, context?: IEditorCommandsContext) {
const editorGroupService = accessor.get(IEditorGroupsService);

const activeEditorPane = editorService.activeEditorPane;
if (!activeEditorPane) {
return;
}
const { group, editor } = resolveCommandsContext(editorGroupService, getCommandsContext(resourceOrContext, context));
if (group && editor) {
const auxiliaryEditorPart = await editorGroupService.createAuxiliaryEditorPart();

const auxiliaryEditorPart = await editorGroupService.createAuxiliaryEditorPart();
if (this.move) {
group.moveEditor(editor, auxiliaryEditorPart.activeGroup);
} else {
group.copyEditor(editor, auxiliaryEditorPart.activeGroup);
}

if (this.move) {
activeEditorPane.group.moveEditor(activeEditorPane.input, auxiliaryEditorPart.activeGroup);
} else {
activeEditorPane.group.copyEditor(activeEditorPane.input, auxiliaryEditorPart.activeGroup);
auxiliaryEditorPart.activeGroup.focus();
}

auxiliaryEditorPart.activeGroup.focus();
}
}

Expand Down