提交 ec1b9fe3 编写于 作者: R Rob Lourens

For #44414, only apply the search F4 shortcut when search results are available

上级 172eea67
......@@ -82,6 +82,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
private fileMatchFocused: IContextKey<boolean>;
private folderMatchFocused: IContextKey<boolean>;
private matchFocused: IContextKey<boolean>;
private hasSearchResultsKey: IContextKey<boolean>;
private searchSubmitted: boolean;
private searching: boolean;
......@@ -137,6 +138,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
this.fileMatchFocused = Constants.FileFocusKey.bindTo(contextKeyService);
this.folderMatchFocused = Constants.FolderFocusKey.bindTo(contextKeyService);
this.matchFocused = Constants.MatchFocusKey.bindTo(this.contextKeyService);
this.hasSearchResultsKey = Constants.HasSearchResults.bindTo(this.contextKeyService);
this.queryBuilder = this.instantiationService.createInstance(QueryBuilder);
this.viewletSettings = this.getMemento(storageService, Scope.WORKSPACE);
......@@ -1297,6 +1299,8 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
private updateSearchResultCount(): void {
const fileCount = this.viewModel.searchResult.fileCount();
this.hasSearchResultsKey.set(fileCount > 0);
const msgWasHidden = this.messages.isHidden();
if (fileCount > 0) {
const div = this.clearMessage();
......
......@@ -27,6 +27,7 @@ export const ReplaceInputBoxFocusedKey = new RawContextKey<boolean>('replaceInpu
export const PatternIncludesFocusedKey = new RawContextKey<boolean>('patternIncludesInputBoxFocus', false);
export const PatternExcludesFocusedKey = new RawContextKey<boolean>('patternExcludesInputBoxFocus', false);
export const ReplaceActiveKey = new RawContextKey<boolean>('replaceActive', false);
export const HasSearchResults = new RawContextKey<boolean>('hasSearchResult', false);
export const FirstMatchFocusKey = new RawContextKey<boolean>('firstMatchFocus', false);
export const FileMatchOrMatchFocusKey = new RawContextKey<boolean>('fileMatchOrMatchFocus', false);
......
......@@ -320,8 +320,8 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F
});
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusNextSearchResultAction, FocusNextSearchResultAction.ID, FocusNextSearchResultAction.LABEL, { primary: KeyCode.F4 }), 'Focus Next Search Result', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusPreviousSearchResultAction, FocusPreviousSearchResultAction.ID, FocusPreviousSearchResultAction.LABEL, { primary: KeyMod.Shift | KeyCode.F4 }), 'Focus Previous Search Result', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusNextSearchResultAction, FocusNextSearchResultAction.ID, FocusNextSearchResultAction.LABEL, { primary: KeyCode.F4 }, ContextKeyExpr.and(Constants.HasSearchResults)), 'Focus Next Search Result', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusPreviousSearchResultAction, FocusPreviousSearchResultAction.ID, FocusPreviousSearchResultAction.LABEL, { primary: KeyMod.Shift | KeyCode.F4 }, ContextKeyExpr.and(Constants.HasSearchResults)), 'Focus Previous Search Result', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ReplaceInFilesAction, ReplaceInFilesAction.ID, ReplaceInFilesAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_H }), 'Replace in Files', category);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册