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

feat(picker.matcher): add option to enable/disable boundary bonus #882

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/snacks/picker/config/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ local defaults = {
-- so this can have a performance impact for large lists and increase memory usage
cwd_bonus = false, -- give bonus for matching files in the cwd
frecency = false, -- frecency bonus
boundary_case_bonus = true, -- give boundary/camel bonus
},
sort = {
-- default sort is by score, text length and index
Expand Down
3 changes: 3 additions & 0 deletions lua/snacks/picker/core/score.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ function M:update(pos)
if not self.prev then
bonus = (bonus * BONUS_FIRST_CHAR_MULTIPLIER)
end
if not self.opts.boundary_case_bonus then
bonus = 0
end

self.score = self.score + SCORE_MATCH + bonus

Expand Down