feat(picker.matcher): internal on_match

This commit is contained in:
Folke Lemaitre 2025-02-04 17:11:23 +01:00
parent 455228ed3a
commit 47b3b69570
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -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