提交 6ceefbe5 编写于 作者: R Rob Lourens

Fix #37556 - remove redundant action

上级 fa4ca603
......@@ -264,7 +264,8 @@ Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets).registerViewlet(new Vie
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
const category = nls.localize('search', "Search");
registry.registerWorkbenchAction(new SyncActionDescriptor(searchActions.OpenSearchViewletAction, Constants.VIEWLET_ID, searchActions.OpenSearchViewletAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F },
// "Show Search" and "Find in Files" are redundant, but we will inevitably break keybindings if we remove one
registry.registerWorkbenchAction(new SyncActionDescriptor(searchActions.FindInFilesAction, Constants.VIEWLET_ID, searchActions.SHOW_SEARCH_LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F },
ContextKeyExpr.and(Constants.SearchViewletVisibleKey.toNegated(), EditorContextKeys.focus.toNegated())), 'View: Show Search', nls.localize('view', "View"));
registry.registerWorkbenchAction(new SyncActionDescriptor(searchActions.FindInFilesAction, Constants.FindInFilesActionId, searchActions.FindInFilesAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F },
ContextKeyExpr.and(Constants.SearchInputBoxFocusedKey.toNegated(), EditorContextKeys.focus.toNegated())), 'Find in Files', category);
......
......@@ -221,32 +221,6 @@ export class FocusPreviousInputAction extends Action {
}
}
export class OpenSearchViewletAction extends ToggleViewletAction {
public static LABEL = nls.localize('showSearchViewlet', "Show Search");
constructor(id: string, label: string, @IViewletService viewletService: IViewletService, @IWorkbenchEditorService editorService: IWorkbenchEditorService) {
super(id, label, Constants.VIEWLET_ID, viewletService, editorService);
}
public run(): TPromise<any> {
const activeViewlet = this.viewletService.getActiveViewlet();
const searchViewletWasOpen = activeViewlet && activeViewlet.getId() === Constants.VIEWLET_ID;
return super.run().then(() => {
if (!searchViewletWasOpen) {
// Get the search viewlet and ensure that 'replace' is collapsed
const searchViewlet = this.viewletService.getActiveViewlet();
if (searchViewlet && searchViewlet.getId() === Constants.VIEWLET_ID) {
const searchAndReplaceWidget = (<SearchViewlet>searchViewlet).searchAndReplaceWidget;
searchAndReplaceWidget.toggleReplace(false);
}
}
});
}
}
export const FocusActiveEditorCommand = (accessor: ServicesAccessor) => {
const editorService = accessor.get(IWorkbenchEditorService);
const editor = editorService.getActiveEditor();
......@@ -289,6 +263,8 @@ export abstract class FindOrReplaceInFilesAction extends Action {
}
}
export const SHOW_SEARCH_LABEL = nls.localize('showSearchViewlet', "Show Search");
export class FindInFilesAction extends FindOrReplaceInFilesAction {
public static LABEL = nls.localize('findInFiles', "Find in Files");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册