Skip to content

Commit dcce2aa

Browse files
authored
workbench: add commands to move editor to start and end (#284999)
Implements actions to move the active editor to the start (index 0) or end of the group. Both commands are registered in the Command Palette as requested, avoiding context menu clutter.
1 parent 8244c9f commit dcce2aa

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
CloseLeftEditorsInGroupAction, OpenNextEditor, OpenPreviousEditor, NavigateBackwardsAction, NavigateForwardAction, NavigatePreviousAction, ReopenClosedEditorAction,
3333
QuickAccessPreviousRecentlyUsedEditorInGroupAction, QuickAccessPreviousEditorFromHistoryAction, ShowAllEditorsByAppearanceAction, ClearEditorHistoryAction, MoveEditorRightInGroupAction, OpenNextEditorInGroup,
3434
OpenPreviousEditorInGroup, OpenNextRecentlyUsedEditorAction, OpenPreviousRecentlyUsedEditorAction, MoveEditorToPreviousGroupAction,
35-
MoveEditorToNextGroupAction, MoveEditorToFirstGroupAction, MoveEditorLeftInGroupAction, ClearRecentFilesAction, OpenLastEditorInGroup,
35+
MoveEditorToNextGroupAction, MoveEditorToFirstGroupAction, MoveEditorLeftInGroupAction, MoveEditorToStartAction, MoveEditorToEndAction, ClearRecentFilesAction, OpenLastEditorInGroup,
3636
ShowEditorsInActiveGroupByMostRecentlyUsedAction, MoveEditorToLastGroupAction, OpenFirstEditorInGroup, MoveGroupUpAction, MoveGroupDownAction, FocusLastGroupAction, SplitEditorLeftAction, SplitEditorRightAction,
3737
SplitEditorUpAction, SplitEditorDownAction, MoveEditorToLeftGroupAction, MoveEditorToRightGroupAction, MoveEditorToAboveGroupAction, MoveEditorToBelowGroupAction, CloseAllEditorGroupsAction,
3838
JoinAllGroupsAction, FocusLeftGroup, FocusAboveGroup, FocusRightGroup, FocusBelowGroup, EditorLayoutSingleAction, EditorLayoutTwoColumnsAction, EditorLayoutThreeColumnsAction, EditorLayoutTwoByTwoGridAction,
@@ -225,6 +225,8 @@ registerAction2(MinimizeOtherGroupsHideSidebarAction);
225225

226226
registerAction2(MoveEditorLeftInGroupAction);
227227
registerAction2(MoveEditorRightInGroupAction);
228+
registerAction2(MoveEditorToStartAction);
229+
registerAction2(MoveEditorToEndAction);
228230

229231
registerAction2(MoveGroupLeftAction);
230232
registerAction2(MoveGroupRightAction);

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2053,6 +2053,30 @@ export class MoveEditorRightInGroupAction extends ExecuteCommandAction {
20532053
}
20542054
}
20552055

2056+
export class MoveEditorToStartAction extends ExecuteCommandAction {
2057+
2058+
constructor() {
2059+
super({
2060+
id: 'workbench.action.moveEditorToStart',
2061+
title: localize2('moveEditorToStart', 'Move Editor to Start'),
2062+
f1: true,
2063+
category: Categories.View
2064+
}, MOVE_ACTIVE_EDITOR_COMMAND_ID, { to: 'first' } satisfies SelectedEditorsMoveCopyArguments);
2065+
}
2066+
}
2067+
2068+
export class MoveEditorToEndAction extends ExecuteCommandAction {
2069+
2070+
constructor() {
2071+
super({
2072+
id: 'workbench.action.moveEditorToEnd',
2073+
title: localize2('moveEditorToEnd', 'Move Editor to End'),
2074+
f1: true,
2075+
category: Categories.View
2076+
}, MOVE_ACTIVE_EDITOR_COMMAND_ID, { to: 'last' } satisfies SelectedEditorsMoveCopyArguments);
2077+
}
2078+
}
2079+
20562080
export class MoveEditorToPreviousGroupAction extends ExecuteCommandAction {
20572081

20582082
constructor() {

0 commit comments

Comments
 (0)