Skip to content

Commit

Permalink
Add preserveInput for quick search and remove col:line (#191260)
Browse files Browse the repository at this point in the history
Fixes #191258
Fixes #191253
  • Loading branch information
andreamah authored Aug 24, 2023
1 parent ee3cf9c commit 27eb58d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { ILabelService } from 'vs/platform/label/common/label';
import { WorkbenchCompressibleObjectTree, getSelectionKeyboardEvent } from 'vs/platform/list/browser/listService';
import { FastAndSlowPicks, IPickerQuickAccessItem, PickerQuickAccessProvider, Picks } from 'vs/platform/quickinput/browser/pickerQuickAccess';
import { DefaultQuickAccessFilterValue } from 'vs/platform/quickinput/common/quickAccess';
import { IKeyMods, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput';
import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IWorkbenchQuickAccessConfiguration } from 'vs/workbench/browser/quickaccess';
import { IWorkbenchEditorConfiguration } from 'vs/workbench/common/editor';
import { IViewsService } from 'vs/workbench/common/views';
import { searchDetailsIcon, searchOpenInFileIcon } from 'vs/workbench/contrib/search/browser/searchIcons';
Expand Down Expand Up @@ -78,16 +78,23 @@ export class TextSearchQuickAccess extends PickerQuickAccessProvider<IPickerQuic
private get configuration() {
const editorConfig = this._configurationService.getValue<IWorkbenchEditorConfiguration>().workbench?.editor;
const searchConfig = this._configurationService.getValue<IWorkbenchSearchConfiguration>().search;
const quickAccessConfig = this._configurationService.getValue<IWorkbenchQuickAccessConfiguration>().workbench.quickOpen;

return {
openEditorPinned: !editorConfig?.enablePreviewFromQuickOpen || !editorConfig?.enablePreview,
preserveInput: quickAccessConfig.preserveInput,
preserveInput: searchConfig.experimental.quickAccess.preserveInput,
maxResults: searchConfig.maxResults,
smartCase: searchConfig.smartCase,
};
}

get defaultFilterValue(): DefaultQuickAccessFilterValue | undefined {
if (this.configuration.preserveInput) {
return DefaultQuickAccessFilterValue.LAST;
}

return undefined;
}

private doSearch(contentPattern: string, token: CancellationToken): {
syncResults: FileMatch[];
asyncResults: Promise<FileMatch[]>;
Expand Down Expand Up @@ -195,7 +202,6 @@ export class TextSearchQuickAccess extends PickerQuickAccessProvider<IPickerQuic
highlights: {
label: match
},
description: `${element.range().startLineNumber}:${element.range().startColumn}`,
ariaLabel: `Match at location ${element.range().startLineNumber}:${element.range().startColumn} - ${previewText}`,
accept: async (keyMods, event) => {
await this.handleAccept(fileMatch, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,12 @@ configurationRegistry.registerConfiguration({
type: 'boolean',
description: nls.localize('search.experimental.closedNotebookResults', "Show notebook editor rich content results for closed notebooks. Please refresh your search results after changing this setting."),
default: false
}
},
'search.experimental.quickAccess.preserveInput': {
'type': 'boolean',
'description': nls.localize('search.experimental.quickAccess.preserveInput', "Controls whether the last typed input to Quick Search should be restored when opening it the next time."),
'default': false
},
}
});

Expand Down
3 changes: 3 additions & 0 deletions src/vs/workbench/services/search/common/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ export interface ISearchConfigurationProperties {
defaultViewMode: ViewMode;
experimental: {
closedNotebookRichContentResults: boolean;
quickAccess: {
preserveInput: boolean;
};
};
}

Expand Down

0 comments on commit 27eb58d

Please sign in to comment.