Skip to content

Give matches after -, ., /, \ and any whitespace the separator bonus [minor] - #108

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/separator-bonus-92
Oct 6, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/separator-bonus-92

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #92

What changed

  • CalculateScoreCore decided separators inline with strChar is '_' or ' '. It now calls a new Fuzzy.IsSeparator(char), which returns true for any whitespace and for _, -, ., / and \.
  • Before this change, a match that started a path segment, a kebab-case word or a dotted name got no matchAfterSeparatorBonus. As a result domain.cs outranked src/main.cs for main, and getlist outranked get-list for list.
  • Updated the matchAfterSeparatorBonus XML doc, the README scoring table and CLAUDE.md to list the new separator set.

Tests

  • New tests:
    • Score("src/main.cs","main") > Score("domain.cs","main")
    • Score("get-list","list") > Score("getlist","list")
    • src-main.cs, src.main.cs, src/main.cs, src\main.cs, src<TAB>main.cs and src main.cs each score the same as src_main.cs, which also covers the tab criterion
    • Direct IsSeparator cases for separator and non-separator characters
  • Checked that the tests catch the bug: with IsSeparator reverted to '_' or ' ', the new tests fail. With the change in place, all 94 tests pass. No existing test needed to change.
  • dotnet build -c Release succeeds with no warnings.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JGKBe8wvU3P6jYj9MkNC69


Generated by Claude Code

…[minor]

Only '_' and a space counted as separators, so a match that starts a path
segment, a kebab-case word or a dotted name scored like one buried mid-word:
"domain.cs" outranked "src/main.cs" for "main". Treat whitespace plus the
common identifier and path separators as word boundaries.

Fixes #92

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JGKBe8wvU3P6jYj9MkNC69
@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

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.

Word-start matches after /, \, -, . or a tab get no separator bonus, so "domain.cs" outranks "src/main.cs" for "main"

2 participants