Skip to content

feat: rank file and folder suggestions by closest match - #485

Open
Christoffer Maintz (CMaintz) wants to merge 1 commit into
microsoft:mainfrom
CMaintz:feat/relevance-sort
Open

Christoffer Maintz (CMaintz) wants to merge 1 commit into
microsoft:mainfrom
CMaintz:feat/relevance-sort

Conversation

@CMaintz

@CMaintz Christoffer Maintz (CMaintz) commented Oct 4, 2026 •

Copy link
Copy Markdown

Path suggestions that share a priority show up in filesystem order. With fuzzy filtering that gets noisy fast: cd s in this repo lists docs and .husky ahead of src, and in my home dir cd i puts IdeaProjects 7th, past the default 5 visible.

Within a priority band, files and folders are now ranked by:

  • match quality: exact, then prefix, then substring
  • shorter names next
  • alphabetical as a last resort, so the order is stable

Only paths are reordered, and only among themselves. Subcommands, options and spec-provided suggestions keep their current order, so things like git st look exactly like before. With nothing typed yet there's nothing to rank, so the order is left alone.

cd s now gives src, shell, scripts, docs, .husky, node_modules. I added that as a runtime test, and pathWithFileFilteredSuggestion changes because shellIntegration.nu now beats shellIntegration.bash on length.

I first had this applied to every suggestion type, but that reshuffled subcommands and options in ways nobody asked for (and broke the git st e2e snapshot), so I narrowed it to paths.

@CMaintz

Christoffer Maintz (CMaintz) commented Oct 4, 2026 •

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Path suggestions sharing a priority showed up in filesystem order, so with fuzzy
filtering `cd s` could list docs before src. Within a priority band, files and
folders are now ranked by match quality (exact, prefix, substring), then shorter
names, then alphabetically. Paths only swap places with other paths, so
subcommands, options and spec suggestions keep their existing order.
@CMaintz Christoffer Maintz (CMaintz) changed the title feat: sort suggestions by closest match within a priority band feat: rank file and folder suggestions by closest match Oct 9, 2026
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.

1 participant