microsoft / vscode

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

Wrong sort order for Go to File #151286

Open timxx opened 2 years ago

timxx commented 2 years ago

Issue Type: Bug

  1. Create files as follow tree:

    ├── pp
    │   └── src
    │       └── app.h
    ├── ps
    │   └── src
    │       └── app.h
  2. Ctrl + P and type ps/app.h

  3. Expected ps/src/app.h sort at first but not actually

VS Code version: Code 1.67.2 (c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5, 2022-05-17T18:15:52.058Z) OS version: Windows_NT x64 10.0.22000 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 5800H with Radeon Graphics (16 x 3194)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|27.87GB (15.45GB free)| |Process Argv|--crash-reporter-id b9977eb4-e704-4623-b964-f4ec24c2d8e9| |Screen Reader|no| |VM|0%|
Extensions (29) Extension|Author (truncated)|Version ---|---|--- typesharp|bon|0.6.0 doxdocgen|csc|1.4.0 gitlens|eam|12.0.7 better-cpp-syntax|jef|1.15.14 vscode-clangd|llv|0.1.17 python|ms-|2022.6.3 vscode-pylance|ms-|2022.6.0 jupyter|ms-|2022.4.1021342353 jupyter-keymap|ms-|1.0.0 jupyter-renderers|ms-|1.0.8 remote-containers|ms-|0.234.0 remote-ssh|ms-|0.80.0 remote-ssh-edit|ms-|0.80.0 remote-wsl|ms-|0.66.3 cmake-tools|ms-|1.10.5 cpptools|ms-|1.9.8 cpptools-extension-pack|ms-|1.2.0 powershell|ms-|2022.5.1 java|red|1.7.0 vscode-xml|red|0.20.0 vscode-yaml|red|1.7.0 omg-idl|RTI|1.0.1 cmake|twx|0.0.17 vscodeintellicode|Vis|1.2.21 vscode-java-debug|vsc|0.41.0 vscode-java-dependency|vsc|0.19.1 vscode-java-pack|vsc|0.23.0 vscode-java-test|vsc|0.35.0 vscode-maven|vsc|0.35.2 (1 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492:30256859 pythonvspyl392:30443607 pythontb:30283811 pythonvspyt551:30345470 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 vscoreces:30445986 pythondataviewer:30285071 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 vsc1dst:30438360 pythonvs932:30410667 wslgetstarted:30449410 vscscmwlcmt:30465135 cppdebug:30492333 vsclangdf:30486550 ```
TylerLeonhardt commented 2 years ago

What do you see instead?

timxx commented 2 years ago

What do you see instead?

image

I'd prefer ps/src/app.h be the first one.

TylerLeonhardt commented 2 years ago

Yeah there's room for improvement here. I'm curious what:

gets... I would expect the same but just curious.

The problem here is that our fuzzy logic is a little strange when you're dealing with only two characters in a folder name. If the ps folder was really pas and you typed pas/app.h I think you'll get what you expect because of our fuzzy algorithm.

A workaround would be to do: "ps" app.h or app.h "ps" which should filter out the pp item... but it would be ideal if this "just worked".

timxx commented 2 years ago

The sort order is the same but with a little different . image

It's nice to have an option to make continuous match part a high score.