telescope-frecency.nvim/lua/frecency/init.lua
JINNOUCHI Yasushi 1f32091e2b
refactor!: use OO & add tests (#100)
* I did an overhall for all codes and added typing by Lua-language-server and tests. It also works on CI.
* Now it searches files on the workspace completely asynchronously. It does not block your text input. (Fix #106)
Make count = 1 when you open a file you've never opened (Fix #107)
2023-08-06 16:02:37 +09:00

30 lines
614 B
Lua

---@type Frecency?
local frecency
return {
---@param opts FrecencyConfig?
setup = function(opts)
frecency = require("frecency.frecency").new(opts)
frecency:setup()
end,
---@param opts FrecencyPickerOptions
start = function(opts)
if frecency then
frecency:start(opts)
end
end,
---@param findstart 1|0
---@param base string
---@return integer|''|string[]
complete = function(findstart, base)
if frecency then
return frecency:complete(findstart, base)
end
return ""
end,
---@return Frecency
frecency = function()
return assert(frecency)
end,
}