microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.42k stars 28.62k forks source link

Quick Pick imprecise filtering breaks after 60 characters #219210

Open Luke-Callaghan23 opened 2 months ago

Luke-Callaghan23 commented 2 months ago

Does this issue occur when all extensions are disabled?: Yes

The filtering for quick pick items which lets you skip characters or words seems to not work on longer strings. Filtering does not work after the 60th character in the string (it seems).

Steps to Reproduce:

  1. Create a quick pick menu with these options:
await vscode.window.showQuickPick([
    "Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliett Kilo Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whiskey X-ray Yankee Zulu",
    "alpha bravo charlie delta echo foxtrot golf hotel india juliett kilo lima mike november oscar papa quebec romeo sierra tango uniform victor whiskey x-ray yankee zulu"
], {
    canPickMany: false,
    title: "Example",
});
  1. In the search bar, type: "Alpha Juli". Both options will remain unfiltered and the strings "Alpha" and "Juli" will be highlighted separately:

image

  1. Type "e". Both options now get filtered:

image

  1. All imprecise searching seems to break after the 60th character (which is the 'e' in 'Juliett'):

https://github.com/microsoft/vscode/assets/56779108/4b888c64-cb6f-4af0-a876-e6b7d30214c6

TylerLeonhardt commented 1 month ago

This is because of this line: https://github.com/microsoft/vscode/blob/bc67f5aa71cb6d331afab14bffe3d44211815d87/src/vs/base/common/filters.ts#L283-L286

Which is cut off likely for performance reasons. Maybe it's worth bumping to a larger number.

TylerLeonhardt commented 1 month ago

@joaomoreno @bpasero your names are all over this file. Any advice?

bpasero commented 1 month ago

Predates my knowledge.