Skip to content

Fix Settings search dropping settings that contain the query substring#310898

Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/settings-search-substring-247715
Open

Fix Settings search dropping settings that contain the query substring#310898
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/settings-search-substring-247715

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

Summary

When a search query is a literal substring of one setting's ID, related settings whose IDs also contain the substring but only fuzzy-match (e.g. differing by a plural "s") were dropped from results.

Example from #247715: typing `instructionfiles` showed `github.copilot.chat.codeGeneration.useInstructionFiles` but not `chat.instructionsFilesLocations` — both settings clearly contain the query substring, but the second only matched as a non-contiguous query because of the plural.

Root cause

`preferencesSearch.ts` computes `topKeyMatchType` from the best key-match score across all results, then filters out any match that doesn't include that exact bit. When one result scores `ContiguousQueryInSettingId` (1<<6) and another only scores `NonContiguousQueryInSettingId` (1<<2), the latter is dropped.

Fix

When any result has a contiguous substring match on a setting ID, the query is specific enough that we keep all key-level matches rather than dropping lower-tier ones. The original "top match type" filter is preserved for purely fuzzy queries where it still protects against noisy results.

Quoting @joaomoreno from the issue:

Both results include the `instructionfiles` substring … If I type `instructionfiles`, both settings need to appear no matter what.

Test plan

  • Search `instructionfiles` → both `useInstructionFiles` and `instructionsFilesLocations` appear
  • Fuzzy queries (e.g. `edt tb siz`) still return only top-tier matches, not a deluge

Fixes #247715

When a search query like "instructionfiles" is a literal substring of
one setting ID (e.g. copilot.chat.codeGeneration.useInstructionFiles),
that match scores ContiguousQueryInSettingId. Other settings whose IDs
also contain the substring but only fuzzy-match (e.g.
chat.instructionsFilesLocations, broken by the plural) score lower and
were dropped by the top-match-type filter, even though they clearly
should appear.

When any result matches via ContiguousQueryInSettingId, widen the
allowed key-match bitmask to include all SettingKeyMatchTypes. The
original "top match type" filter is preserved for purely fuzzy queries,
where it protects against noisy results.

Fixes microsoft#247715
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@rzhao271

Matched files:

  • src/vs/workbench/contrib/preferences/browser/preferencesSearch.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings Editor fails to find a setting with simple substring search

2 participants