Skip to content

Commit df42214

Browse files
authored
aux window - fix action context for move/copy (fix microsoft#199799) (microsoft#199851)
aux window - fix action context for move/copy
1 parent da4bbf3 commit df42214

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/vs/workbench/browser/parts/editor/editorActions.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,7 @@ export class ToggleMaximizeEditorGroupAction extends Action2 {
11451145

11461146
override async run(accessor: ServicesAccessor, resourceOrContext?: URI | IEditorCommandsContext, context?: IEditorCommandsContext): Promise<void> {
11471147
const editorGroupsService = accessor.get(IEditorGroupsService);
1148+
11481149
const { group } = resolveCommandsContext(editorGroupsService, getCommandsContext(resourceOrContext, context));
11491150
editorGroupsService.toggleMaximizeGroup(group);
11501151
}
@@ -2503,24 +2504,21 @@ abstract class BaseMoveCopyEditorToNewWindowAction extends Action2 {
25032504
});
25042505
}
25052506

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

2510-
const activeEditorPane = editorService.activeEditorPane;
2511-
if (!activeEditorPane) {
2512-
return;
2513-
}
2510+
const { group, editor } = resolveCommandsContext(editorGroupService, getCommandsContext(resourceOrContext, context));
2511+
if (group && editor) {
2512+
const auxiliaryEditorPart = await editorGroupService.createAuxiliaryEditorPart();
25142513

2515-
const auxiliaryEditorPart = await editorGroupService.createAuxiliaryEditorPart();
2514+
if (this.move) {
2515+
group.moveEditor(editor, auxiliaryEditorPart.activeGroup);
2516+
} else {
2517+
group.copyEditor(editor, auxiliaryEditorPart.activeGroup);
2518+
}
25162519

2517-
if (this.move) {
2518-
activeEditorPane.group.moveEditor(activeEditorPane.input, auxiliaryEditorPart.activeGroup);
2519-
} else {
2520-
activeEditorPane.group.copyEditor(activeEditorPane.input, auxiliaryEditorPart.activeGroup);
2520+
auxiliaryEditorPart.activeGroup.focus();
25212521
}
2522-
2523-
auxiliaryEditorPart.activeGroup.focus();
25242522
}
25252523
}
25262524

0 commit comments

Comments
 (0)