提交 56a962fd 编写于 作者: A Alex Dima

Move more menu bar registrations close to the actions

上级 27a7ad9f
...@@ -1711,6 +1711,12 @@ registerCommand(new EditorOrNativeTextInputCommand({ ...@@ -1711,6 +1711,12 @@ registerCommand(new EditorOrNativeTextInputCommand({
weight: CORE_WEIGHT, weight: CORE_WEIGHT,
kbExpr: null, kbExpr: null,
primary: KeyMod.CtrlCmd | KeyCode.KEY_A primary: KeyMod.CtrlCmd | KeyCode.KEY_A
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '1_basic',
title: nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, "&&Select All"),
order: 1
} }
})); }));
......
...@@ -24,6 +24,7 @@ import { TypeOperations } from 'vs/editor/common/controller/cursorTypeOperations ...@@ -24,6 +24,7 @@ import { TypeOperations } from 'vs/editor/common/controller/cursorTypeOperations
import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands'; import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { MenuId } from 'vs/platform/actions/common/actions';
// copy lines // copy lines
...@@ -63,6 +64,12 @@ class CopyLinesUpAction extends AbstractCopyLinesAction { ...@@ -63,6 +64,12 @@ class CopyLinesUpAction extends AbstractCopyLinesAction {
primary: KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow, primary: KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow,
linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow }, linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow },
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '2_line',
title: nls.localize({ key: 'miCopyLinesUp', comment: ['&& denotes a mnemonic'] }, "&&Copy Line Up"),
order: 1
} }
}); });
} }
...@@ -80,6 +87,12 @@ class CopyLinesDownAction extends AbstractCopyLinesAction { ...@@ -80,6 +87,12 @@ class CopyLinesDownAction extends AbstractCopyLinesAction {
primary: KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow, primary: KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow,
linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow }, linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow },
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '2_line',
title: nls.localize({ key: 'miCopyLinesDown', comment: ['&& denotes a mnemonic'] }, "Co&&py Line Down"),
order: 2
} }
}); });
} }
...@@ -124,6 +137,12 @@ class MoveLinesUpAction extends AbstractMoveLinesAction { ...@@ -124,6 +137,12 @@ class MoveLinesUpAction extends AbstractMoveLinesAction {
primary: KeyMod.Alt | KeyCode.UpArrow, primary: KeyMod.Alt | KeyCode.UpArrow,
linux: { primary: KeyMod.Alt | KeyCode.UpArrow }, linux: { primary: KeyMod.Alt | KeyCode.UpArrow },
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '2_line',
title: nls.localize({ key: 'miMoveLinesUp', comment: ['&& denotes a mnemonic'] }, "Mo&&ve Line Up"),
order: 3
} }
}); });
} }
...@@ -141,6 +160,12 @@ class MoveLinesDownAction extends AbstractMoveLinesAction { ...@@ -141,6 +160,12 @@ class MoveLinesDownAction extends AbstractMoveLinesAction {
primary: KeyMod.Alt | KeyCode.DownArrow, primary: KeyMod.Alt | KeyCode.DownArrow,
linux: { primary: KeyMod.Alt | KeyCode.DownArrow }, linux: { primary: KeyMod.Alt | KeyCode.DownArrow },
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '2_line',
title: nls.localize({ key: 'miMoveLinesDown', comment: ['&& denotes a mnemonic'] }, "Move &&Line Down"),
order: 4
} }
}); });
} }
......
...@@ -26,6 +26,7 @@ import { themeColorFromId } from 'vs/platform/theme/common/themeService'; ...@@ -26,6 +26,7 @@ import { themeColorFromId } from 'vs/platform/theme/common/themeService';
import { INewFindReplaceState, FindOptionOverride } from 'vs/editor/contrib/find/findState'; import { INewFindReplaceState, FindOptionOverride } from 'vs/editor/contrib/find/findState';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { MenuId } from 'vs/platform/actions/common/actions';
export class InsertCursorAbove extends EditorAction { export class InsertCursorAbove extends EditorAction {
...@@ -43,6 +44,12 @@ export class InsertCursorAbove extends EditorAction { ...@@ -43,6 +44,12 @@ export class InsertCursorAbove extends EditorAction {
secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.UpArrow] secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.UpArrow]
}, },
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '3_multi',
title: nls.localize({ key: 'miInsertCursorAbove', comment: ['&& denotes a mnemonic'] }, "&&Add Cursor Above"),
order: 2
} }
}); });
} }
...@@ -82,6 +89,12 @@ export class InsertCursorBelow extends EditorAction { ...@@ -82,6 +89,12 @@ export class InsertCursorBelow extends EditorAction {
secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.DownArrow] secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.DownArrow]
}, },
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '3_multi',
title: nls.localize({ key: 'miInsertCursorBelow', comment: ['&& denotes a mnemonic'] }, "A&&dd Cursor Below"),
order: 3
} }
}); });
} }
...@@ -117,6 +130,12 @@ class InsertCursorAtEndOfEachLineSelected extends EditorAction { ...@@ -117,6 +130,12 @@ class InsertCursorAtEndOfEachLineSelected extends EditorAction {
kbExpr: EditorContextKeys.editorTextFocus, kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_I, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_I,
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '3_multi',
title: nls.localize({ key: 'miInsertCursorAtEndOfEachLineSelected', comment: ['&& denotes a mnemonic'] }, "Add C&&ursors to Line Ends"),
order: 4
} }
}); });
} }
...@@ -528,6 +547,12 @@ export class AddSelectionToNextFindMatchAction extends MultiCursorSelectionContr ...@@ -528,6 +547,12 @@ export class AddSelectionToNextFindMatchAction extends MultiCursorSelectionContr
kbExpr: EditorContextKeys.focus, kbExpr: EditorContextKeys.focus,
primary: KeyMod.CtrlCmd | KeyCode.KEY_D, primary: KeyMod.CtrlCmd | KeyCode.KEY_D,
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '3_multi',
title: nls.localize({ key: 'miAddSelectionToNextFindMatch', comment: ['&& denotes a mnemonic'] }, "Add &&Next Occurrence"),
order: 5
} }
}); });
} }
...@@ -542,7 +567,13 @@ export class AddSelectionToPreviousFindMatchAction extends MultiCursorSelectionC ...@@ -542,7 +567,13 @@ export class AddSelectionToPreviousFindMatchAction extends MultiCursorSelectionC
id: 'editor.action.addSelectionToPreviousFindMatch', id: 'editor.action.addSelectionToPreviousFindMatch',
label: nls.localize('addSelectionToPreviousFindMatch', "Add Selection To Previous Find Match"), label: nls.localize('addSelectionToPreviousFindMatch', "Add Selection To Previous Find Match"),
alias: 'Add Selection To Previous Find Match', alias: 'Add Selection To Previous Find Match',
precondition: null precondition: null,
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '3_multi',
title: nls.localize({ key: 'miAddSelectionToPreviousFindMatch', comment: ['&& denotes a mnemonic'] }, "Add P&&revious Occurrence"),
order: 6
}
}); });
} }
protected _run(multiCursorController: MultiCursorSelectionController, findController: CommonFindController): void { protected _run(multiCursorController: MultiCursorSelectionController, findController: CommonFindController): void {
...@@ -594,6 +625,12 @@ export class SelectHighlightsAction extends MultiCursorSelectionControllerAction ...@@ -594,6 +625,12 @@ export class SelectHighlightsAction extends MultiCursorSelectionControllerAction
kbExpr: EditorContextKeys.focus, kbExpr: EditorContextKeys.focus,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_L, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_L,
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '3_multi',
title: nls.localize({ key: 'miSelectHighlights', comment: ['&& denotes a mnemonic'] }, "Select All &&Occurrences"),
order: 7
} }
}); });
} }
......
...@@ -17,6 +17,7 @@ import { TokenSelectionSupport, ILogicalSelectionEntry } from './tokenSelectionS ...@@ -17,6 +17,7 @@ import { TokenSelectionSupport, ILogicalSelectionEntry } from './tokenSelectionS
import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents'; import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { MenuId } from 'vs/platform/actions/common/actions';
// --- selection state machine // --- selection state machine
...@@ -176,6 +177,12 @@ class GrowSelectionAction extends AbstractSmartSelect { ...@@ -176,6 +177,12 @@ class GrowSelectionAction extends AbstractSmartSelect {
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.RightArrow, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.RightArrow,
mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.RightArrow }, mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.RightArrow },
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '1_basic',
title: nls.localize({ key: 'miSmartSelectGrow', comment: ['&& denotes a mnemonic'] }, "&&Expand Selection"),
order: 2
} }
}); });
} }
...@@ -193,6 +200,12 @@ class ShrinkSelectionAction extends AbstractSmartSelect { ...@@ -193,6 +200,12 @@ class ShrinkSelectionAction extends AbstractSmartSelect {
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.LeftArrow, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.LeftArrow,
mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.LeftArrow }, mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.LeftArrow },
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
},
menubarOpts: {
menuId: MenuId.MenubarSelectionMenu,
group: '1_basic',
title: nls.localize({ key: 'miSmartSelectShrink', comment: ['&& denotes a mnemonic'] }, "&&Shrink Selection"),
order: 3
} }
}); });
} }
......
...@@ -10,68 +10,6 @@ import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; ...@@ -10,68 +10,6 @@ import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
selectionMenuRegistration(); selectionMenuRegistration();
function selectionMenuRegistration() { function selectionMenuRegistration() {
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '1_basic',
command: {
id: 'editor.action.selectAll',
title: nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, "&&Select All")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '1_basic',
command: {
id: 'editor.action.smartSelect.grow',
title: nls.localize({ key: 'miSmartSelectGrow', comment: ['&& denotes a mnemonic'] }, "&&Expand Selection")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '1_basic',
command: {
id: 'editor.action.smartSelect.shrink',
title: nls.localize({ key: 'miSmartSelectShrink', comment: ['&& denotes a mnemonic'] }, "&&Shrink Selection")
},
order: 3
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '2_line',
command: {
id: 'editor.action.copyLinesUpAction',
title: nls.localize({ key: 'miCopyLinesUp', comment: ['&& denotes a mnemonic'] }, "&&Copy Line Up")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '2_line',
command: {
id: 'editor.action.copyLinesDownAction',
title: nls.localize({ key: 'miCopyLinesDown', comment: ['&& denotes a mnemonic'] }, "Co&&py Line Down")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '2_line',
command: {
id: 'editor.action.moveLinesUpAction',
title: nls.localize({ key: 'miMoveLinesUp', comment: ['&& denotes a mnemonic'] }, "Mo&&ve Line Up")
},
order: 3
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '2_line',
command: {
id: 'editor.action.moveLinesDownAction',
title: nls.localize({ key: 'miMoveLinesDown', comment: ['&& denotes a mnemonic'] }, "Move &&Line Down")
},
order: 4
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '3_multi', group: '3_multi',
...@@ -82,57 +20,4 @@ function selectionMenuRegistration() { ...@@ -82,57 +20,4 @@ function selectionMenuRegistration() {
order: 1 order: 1
}); });
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '3_multi',
command: {
id: 'editor.action.insertCursorAbove',
title: nls.localize({ key: 'miInsertCursorAbove', comment: ['&& denotes a mnemonic'] }, "&&Add Cursor Above")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '3_multi',
command: {
id: 'editor.action.insertCursorBelow',
title: nls.localize({ key: 'miInsertCursorBelow', comment: ['&& denotes a mnemonic'] }, "A&&dd Cursor Below")
},
order: 3
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '3_multi',
command: {
id: 'editor.action.insertCursorAtEndOfEachLineSelected',
title: nls.localize({ key: 'miInsertCursorAtEndOfEachLineSelected', comment: ['&& denotes a mnemonic'] }, "Add C&&ursors to Line Ends")
},
order: 4
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '3_multi',
command: {
id: 'editor.action.addSelectionToNextFindMatch',
title: nls.localize({ key: 'miAddSelectionToNextFindMatch', comment: ['&& denotes a mnemonic'] }, "Add &&Next Occurrence")
},
order: 5
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '3_multi',
command: {
id: 'editor.action.addSelectionToPreviousFindMatch',
title: nls.localize({ key: 'miAddSelectionToPreviousFindMatch', comment: ['&& denotes a mnemonic'] }, "Add P&&revious Occurrence")
},
order: 6
});
MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
group: '3_multi',
command: {
id: 'editor.action.selectHighlights',
title: nls.localize({ key: 'miSelectHighlights', comment: ['&& denotes a mnemonic'] }, "Select All &&Occurrences")
},
order: 7
});
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册