mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
feat(picker.matcher): internal on_match
This commit is contained in:
parent
455228ed3a
commit
47b3b69570
1 changed files with 4 additions and 0 deletions
|
@ -6,6 +6,7 @@ local Async = require("snacks.picker.util.async")
|
|||
|
||||
---@class snacks.picker.matcher.Config
|
||||
---@field regex? boolean used internally for positions of sources that use regex
|
||||
---@field on_match? fun(matcher: snacks.picker.Matcher, item: snacks.picker.Item)
|
||||
|
||||
---@class snacks.picker.Matcher
|
||||
---@field opts snacks.picker.matcher.Config
|
||||
|
@ -327,6 +328,9 @@ function M:update(item)
|
|||
score = score + BONUS_CWD
|
||||
end
|
||||
end
|
||||
if self.opts.on_match then
|
||||
self.opts.on_match(self, item)
|
||||
end
|
||||
end
|
||||
item.match_tick, item.score, item.match_topk = self.tick, score, nil
|
||||
return score > 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue