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

Incorrect prioritization of filename suggestions in quick open dialog (Ctrl+P) #170353

Open
waldyrious opened this issue Jan 1, 2023 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug quick-open Quick-open issues (search, commands)
Milestone

Comments

@waldyrious
Copy link
Contributor

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

  • VS Code Version: 1.74.2
  • OS Version: Ubuntu 20.04

Steps to Reproduce:

  1. Clone the mdn/content repository
  2. Open the quick open dialog by pressing Ctrl+P
  3. type "ftu index" or "glossary ftu index"
  4. Observe that the files/en-us/glossary/ftu/index.md is not the first result. Instead, other results that split the "ftu" into separate letters (like e.g. files/en-us/glossary/turn/index.md) get higher priority.

image

c7M3wvdjqM

@TylerLeonhardt
Copy link
Member

Does this repro a similar behavior when your second word has more than 3 characters? So like stun index? I think the problem here is that matching the first character in the path is weighted higher than an exact word match inside of the path.

cc @bpasero if you have thoughts.

@TylerLeonhardt TylerLeonhardt added the info-needed Issue requires more information from poster label Jan 13, 2023
@bpasero
Copy link
Member

bpasero commented Jan 14, 2023

You can print diagnostics by commenting out all the code that uses DEBUG and/or DEBUG_MATRIX:

// const DEBUG = false;
// const DEBUG_MATRIX = false;

I noticed it was not very clear so I have #171308 opened to improve the output.

Running so (with my changes) produces (for ftu):

image

I think the issue here is that we give the initial f a higher score since it is at "beginning of word" and thus wins over the f at the end of the path (by a few points). Note that we consider workspace relative paths for matching, hence the path starts with f.

I think the algorithm here fails to recognise that the ftu at the end of the path would produce an overall higher score given the consecutive bonus over the scattered ftu, where f matches at the beginning. I am not 100% sure why that is, because as far as I remember we match each input character over all possible combinations and then take the highest score. Would be something maybe to investigate and follow up.

@bpasero
Copy link
Member

bpasero commented Jan 14, 2023

Matrix:

        f	 i	    l	    e	    s	    /	    e	    n	    -	    u	    s	    /	    g	    l	    o	    s	    s	    a	    r	    y	    /	    f	    t	    u	    /	    i	    n	    d	    e	    x	    .	    m	    d
f	M1/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	M0/S10	
t	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M1/S12	M0/S12	M0/S12	M0/S12	M0/S12	M0/S12	M0/S12	M0/S12	M0/S12	M0/S12	M0/S12	
u	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M0/S0	M2/S19	M0/S19	M0/S19	M0/S19	M0/S19	M0/S19	M0/S19	M0/S19	M0/S19	M0/S19

image

@bpasero
Copy link
Member

bpasero commented Jan 14, 2023

Previously reported as #56667 and #69648

@TylerLeonhardt TylerLeonhardt added bug Issue identified by VS Code Team member as probable bug quick-open Quick-open issues (search, commands) and removed info-needed Issue requires more information from poster labels Jan 19, 2023
@TylerLeonhardt TylerLeonhardt added this to the Backlog milestone Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug quick-open Quick-open issues (search, commands)
Projects
None yet
Development

No branches or pull requests

3 participants