提交 c31d6ed4 编写于 作者: I isidor

search: some more renames

上级 5b72618e
......@@ -23,7 +23,7 @@ import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/commo
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { VIEW_ID } from 'vs/platform/search/common/search';
export function isSearchViewletFocused(viewletService: IViewletService, panelService: IPanelService): boolean {
export function isSearchViewFocused(viewletService: IViewletService, panelService: IPanelService): boolean {
let searchView = getSearchView(viewletService, panelService);
let activeElement = document.activeElement;
return searchView && activeElement && DOM.isAncestor(activeElement, searchView.getContainer().getHTMLElement());
......@@ -83,7 +83,7 @@ export class ShowNextSearchIncludeAction extends Action {
public static readonly ID = 'search.history.showNextIncludePattern';
public static readonly LABEL = nls.localize('nextSearchIncludePattern', "Show Next Search Include Pattern");
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.PatternIncludesFocusedKey);
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.PatternIncludesFocusedKey);
constructor(id: string, label: string,
@IViewletService private viewletService: IViewletService,
......@@ -105,7 +105,7 @@ export class ShowPreviousSearchIncludeAction extends Action {
public static readonly ID = 'search.history.showPreviousIncludePattern';
public static readonly LABEL = nls.localize('previousSearchIncludePattern', "Show Previous Search Include Pattern");
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.PatternIncludesFocusedKey);
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.PatternIncludesFocusedKey);
constructor(id: string, label: string,
@IViewletService private viewletService: IViewletService,
......@@ -127,7 +127,7 @@ export class ShowNextSearchExcludeAction extends Action {
public static readonly ID = 'search.history.showNextExcludePattern';
public static readonly LABEL = nls.localize('nextSearchExcludePattern', "Show Next Search Exclude Pattern");
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.PatternExcludesFocusedKey);
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.PatternExcludesFocusedKey);
constructor(id: string, label: string,
@IViewletService private viewletService: IViewletService,
......@@ -149,7 +149,7 @@ export class ShowPreviousSearchExcludeAction extends Action {
public static readonly ID = 'search.history.showPreviousExcludePattern';
public static readonly LABEL = nls.localize('previousSearchExcludePattern', "Show Previous Search Exclude Pattern");
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.PatternExcludesFocusedKey);
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.PatternExcludesFocusedKey);
constructor(id: string, label: string,
@IViewletService private viewletService: IViewletService,
......@@ -171,7 +171,7 @@ export class ShowNextSearchTermAction extends Action {
public static readonly ID = 'search.history.showNext';
public static readonly LABEL = nls.localize('nextSearchTerm', "Show Next Search Term");
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.SearchInputBoxFocusedKey);
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.SearchInputBoxFocusedKey);
constructor(id: string, label: string,
@IViewletService private viewletService: IViewletService,
......@@ -193,7 +193,7 @@ export class ShowPreviousSearchTermAction extends Action {
public static readonly ID = 'search.history.showPrevious';
public static readonly LABEL = nls.localize('previousSearchTerm', "Show Previous Search Term");
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.SearchInputBoxFocusedKey);
public static CONTEXT_KEY_EXPRESSION: ContextKeyExpr = ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.SearchInputBoxFocusedKey);
constructor(id: string, label: string,
@IViewletService private viewletService: IViewletService,
......
......@@ -5,7 +5,7 @@
'use strict';
import 'vs/css!./media/searchviewlet';
import 'vs/css!./media/searchview';
import nls = require('vs/nls');
import { TPromise } from 'vs/base/common/winjs.base';
import { Emitter, debounceEvent } from 'vs/base/common/event';
......@@ -128,7 +128,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
) {
super(VIEW_ID, partService, telemetryService, themeService);
this.viewletVisible = Constants.SearchViewletVisibleKey.bindTo(contextKeyService);
this.viewletVisible = Constants.SearchViewVisibleKey.bindTo(contextKeyService);
this.inputBoxFocused = Constants.InputBoxFocusedKey.bindTo(this.contextKeyService);
this.inputPatternIncludesFocused = Constants.PatternIncludesFocusedKey.bindTo(this.contextKeyService);
this.inputPatternExclusionsFocused = Constants.PatternExcludesFocusedKey.bindTo(this.contextKeyService);
......
......@@ -22,7 +22,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import Event, { Emitter } from 'vs/base/common/event';
import { Builder } from 'vs/base/browser/builder';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { isSearchViewletFocused, appendKeyBindingLabel } from 'vs/workbench/parts/search/browser/searchActions';
import { isSearchViewFocused, appendKeyBindingLabel } from 'vs/workbench/parts/search/browser/searchActions';
import { HistoryNavigator } from 'vs/base/common/history';
import * as Constants from 'vs/workbench/parts/search/common/constants';
import { attachInputBoxStyler, attachFindInputBoxStyler, attachButtonStyler } from 'vs/platform/theme/common/styler';
......@@ -403,10 +403,10 @@ export function registerContributions() {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: ReplaceAllAction.ID,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.ReplaceActiveKey, CONTEXT_FIND_WIDGET_NOT_VISIBLE),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceActiveKey, CONTEXT_FIND_WIDGET_NOT_VISIBLE),
primary: KeyMod.Alt | KeyMod.CtrlCmd | KeyCode.Enter,
handler: accessor => {
if (isSearchViewletFocused(accessor.get(IViewletService), accessor.get(IPanelService))) {
if (isSearchViewFocused(accessor.get(IViewletService), accessor.get(IPanelService))) {
ReplaceAllAction.INSTANCE.run();
}
}
......
......@@ -20,7 +20,7 @@ export const ToggleCaseSensitiveCommandId = 'toggleSearchCaseSensitive';
export const ToggleWholeWordCommandId = 'toggleSearchWholeWord';
export const ToggleRegexCommandId = 'toggleSearchRegex';
export const SearchViewletVisibleKey = new RawContextKey<boolean>('searchViewletVisible', true);
export const SearchViewVisibleKey = new RawContextKey<boolean>('searchViewletVisible', true);
export const InputBoxFocusedKey = new RawContextKey<boolean>('inputBoxFocus', false);
export const SearchInputBoxFocusedKey = new RawContextKey<boolean>('searchInputBoxFocus', false);
export const ReplaceInputBoxFocusedKey = new RawContextKey<boolean>('replaceInputBoxFocus', false);
......
......@@ -158,7 +158,7 @@ export class QueryBuilder {
}
/**
* Takes the input from the excludePattern as seen in the searchViewlet. Runs the same algorithm as parseSearchPaths,
* Takes the input from the excludePattern as seen in the searchView. Runs the same algorithm as parseSearchPaths,
* but the result is a single IExpression that encapsulates all the exclude patterns.
*/
public parseExcludePattern(pattern: string): glob.IExpression | undefined {
......
......@@ -66,7 +66,7 @@ searchWidgetContributions();
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'workbench.action.search.toggleQueryDetails',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: Constants.SearchViewletVisibleKey,
when: Constants.SearchViewVisibleKey,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_J,
handler: accessor => {
openSearchView(accessor.get(IViewletService), accessor.get(IPanelService), true)
......@@ -77,7 +77,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: Constants.FocusSearchFromResults,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.FirstMatchFocusKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.FirstMatchFocusKey),
primary: KeyCode.UpArrow,
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
......@@ -88,7 +88,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: Constants.OpenMatchToSide,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.FileMatchOrMatchFocusKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.FileMatchOrMatchFocusKey),
primary: KeyMod.CtrlCmd | KeyCode.Enter,
mac: {
primary: KeyMod.WinCtrl | KeyCode.Enter
......@@ -103,7 +103,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: Constants.CancelActionId,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, WorkbenchListFocusContextKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, WorkbenchListFocusContextKey),
primary: KeyCode.Escape,
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
......@@ -114,7 +114,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: Constants.RemoveActionId,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.FileMatchOrMatchFocusKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.FileMatchOrMatchFocusKey),
primary: KeyCode.Delete,
mac: {
primary: KeyMod.CtrlCmd | KeyCode.Backspace,
......@@ -129,7 +129,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: Constants.ReplaceActionId,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.ReplaceActiveKey, Constants.MatchFocusKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceActiveKey, Constants.MatchFocusKey),
primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.KEY_1,
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
......@@ -141,7 +141,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: Constants.ReplaceAllInFileActionId,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.ReplaceActiveKey, Constants.FileFocusKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceActiveKey, Constants.FileFocusKey),
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter,
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
......@@ -153,7 +153,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: Constants.ReplaceAllInFolderActionId,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.ReplaceActiveKey, Constants.FolderFocusKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceActiveKey, Constants.FolderFocusKey),
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter,
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
......@@ -165,7 +165,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: Constants.CloseReplaceWidgetActionId,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.ReplaceInputBoxFocusedKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceInputBoxFocusedKey),
primary: KeyCode.Escape,
handler: (accessor, args: any) => {
accessor.get(IInstantiationService).createInstance(CloseReplaceAction, Constants.CloseReplaceWidgetActionId, '').run();
......@@ -175,7 +175,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: FocusNextInputAction.ID,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.InputBoxFocusedKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.InputBoxFocusedKey),
primary: KeyCode.DownArrow,
handler: (accessor, args: any) => {
accessor.get(IInstantiationService).createInstance(FocusNextInputAction, FocusNextInputAction.ID, '').run();
......@@ -185,7 +185,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: FocusPreviousInputAction.ID,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.InputBoxFocusedKey, Constants.SearchInputBoxFocusedKey.toNegated()),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.InputBoxFocusedKey, Constants.SearchInputBoxFocusedKey.toNegated()),
primary: KeyCode.UpArrow,
handler: (accessor, args: any) => {
accessor.get(IInstantiationService).createInstance(FocusPreviousInputAction, FocusPreviousInputAction.ID, '').run();
......@@ -307,15 +307,15 @@ Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).regi
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
const category = nls.localize('search', "Search");
registry.registerWorkbenchAction(new SyncActionDescriptor(FindInFilesAction, VIEW_ID, nls.localize('showSearchViewlet', "Show Search"), { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F },
Constants.SearchViewletVisibleKey.toNegated()), 'View: Show Search', nls.localize('view', "View"));
registry.registerWorkbenchAction(new SyncActionDescriptor(FindInFilesAction, VIEW_ID, nls.localize('showSearchViewl', "Show Search"), { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F },
Constants.SearchViewVisibleKey.toNegated()), 'View: Show Search', nls.localize('view', "View"));
registry.registerWorkbenchAction(new SyncActionDescriptor(FindInFilesAction, Constants.FindInFilesActionId, nls.localize('findInFiles', "Find in Files"), { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F },
Constants.SearchInputBoxFocusedKey.toNegated()), 'Find in Files', category);
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: Constants.FocusActiveEditorCommandId,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.SearchInputBoxFocusedKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.SearchInputBoxFocusedKey),
handler: FocusActiveEditorCommand,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F
});
......@@ -328,21 +328,21 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(ReplaceInFilesAction,
KeybindingsRegistry.registerCommandAndKeybindingRule(objects.assign({
id: Constants.ToggleCaseSensitiveCommandId,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.SearchInputBoxFocusedKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.SearchInputBoxFocusedKey),
handler: toggleCaseSensitiveCommand
}, ToggleCaseSensitiveKeybinding));
KeybindingsRegistry.registerCommandAndKeybindingRule(objects.assign({
id: Constants.ToggleWholeWordCommandId,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.SearchInputBoxFocusedKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.SearchInputBoxFocusedKey),
handler: toggleWholeWordCommand
}, ToggleWholeWordKeybinding));
KeybindingsRegistry.registerCommandAndKeybindingRule(objects.assign({
id: Constants.ToggleRegexCommandId,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ContextKeyExpr.and(Constants.SearchViewletVisibleKey, Constants.SearchInputBoxFocusedKey),
when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.SearchInputBoxFocusedKey),
handler: toggleRegexCommand
}, ToggleRegexKeybinding));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册