Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick search: Not possible to search for space in front #201015

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/vs/platform/quickinput/browser/pickerQuickAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export interface IPickerQuickAccessProviderOptions<T extends IPickerQuickAccessI
* Enables to show a pick entry when no results are returned from a search.
*/
readonly noResultsPick?: T | ((filter: string) => T);

/** Whether to skip trimming the pick filter string */
readonly shouldSkipTrimPickFilter?: boolean;
}

export type Pick<T> = T | IQuickPickSeparator;
Expand Down Expand Up @@ -138,7 +141,12 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem

// Collect picks and support both long running and short or combined
const picksToken = picksCts.token;
const picksFilter = picker.value.substr(this.prefix.length).trim();
let picksFilter = picker.value.substring(this.prefix.length);

if (!this.options?.shouldSkipTrimPickFilter) {
picksFilter = picksFilter.trim();
}

const providedPicks = this._getPicks(picksFilter, picksDisposables, picksToken, runOptions);

const applyPicks = (picks: Picks<T>, skipEmpty?: boolean): boolean => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class TextSearchQuickAccess extends PickerQuickAccessProvider<IPickerQuic
@IViewsService private readonly _viewsService: IViewsService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
) {
super(TEXT_SEARCH_QUICK_ACCESS_PREFIX, { canAcceptInBackground: true });
super(TEXT_SEARCH_QUICK_ACCESS_PREFIX, { canAcceptInBackground: true, shouldSkipTrimPickFilter: true });

this.queryBuilder = this._instantiationService.createInstance(QueryBuilder);
this.searchModel = this._instantiationService.createInstance(SearchModel);
Expand Down