提交 7d16ea92 编写于 作者: A AJ Kerrigan

Add keybinding options for Replace and Replace All (#2004)

Add editor commands for the Replace (ReplaceOne) and ReplaceAll
actions. Provide default keybindings which only fire when the
Replace widget is visible.
上级 a5a6fe21
......@@ -484,7 +484,7 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
// Replace one button
this._replaceBtn = this._register(new SimpleButton({
label: NLS_REPLACE_BTN_LABEL,
label: NLS_REPLACE_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.ReplaceOneAction),
className: 'replace',
onTrigger: () => {
this._controller.replace();
......@@ -499,7 +499,7 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
// Replace all button
this._replaceAllBtn = this._register(new SimpleButton({
label: NLS_REPLACE_ALL_BTN_LABEL,
label: NLS_REPLACE_ALL_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.ReplaceAllAction),
className: 'replace-all',
onTrigger: () => {
this._controller.replaceAll();
......
......@@ -673,3 +673,9 @@ registerFindCommand(FIND_IDS.ToggleRegexCommand, x => x.toggleRegex(), {
primary: KeyMod.Alt | KeyCode.KEY_R,
mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_R }
});
registerFindCommand(FIND_IDS.ReplaceOneAction, x => x.replace(), {
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_H
});
registerFindCommand(FIND_IDS.ReplaceAllAction, x => x.replaceAll(), {
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Enter
});
......@@ -27,7 +27,9 @@ export const FIND_IDS = {
CloseFindWidgetCommand: 'closeFindWidget',
ToggleCaseSensitiveCommand: 'toggleFindCaseSensitive',
ToggleWholeWordCommand: 'toggleFindWholeWord',
ToggleRegexCommand: 'toggleFindRegex'
ToggleRegexCommand: 'toggleFindRegex',
ReplaceOneAction: 'editor.action.replaceOne',
ReplaceAllAction: 'editor.action.replaceAll'
}
export const MATCHES_LIMIT = 999;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册