mirror of
https://github.com/kristoferssolo/telescope-frecency.nvim.git
synced 2025-10-21 20:10:38 +00:00
* refactor: simplify logic to load web_devicons * refactor: make register() asynchronous * fix: load lazily modules outside this plugin * refactor: simplify logic to wait initialization * refactor: use uv.hrtime() instead of os.clock() * fix: avoid errors in calling plenary.log in async * test: store elapsed time to check in tests * test: fix module names This becomes a problem only in Ubuntu because macOS and Windows does not care cases in filenames. * test: fix types and unused modules * style: fix by stylua * refactor: make recency / entry_maker loaded lazily
27 lines
617 B
Lua
27 lines
617 B
Lua
local config = require "frecency.config"
|
|
local log = require "frecency.log"
|
|
local uv = vim.uv or vim.loop
|
|
|
|
---@class FrecencyTimer
|
|
---@field elapsed number
|
|
---@field start integer
|
|
---@field title string
|
|
local Timer = {}
|
|
|
|
---@param title string
|
|
---@return FrecencyTimer
|
|
Timer.new = function(title)
|
|
return setmetatable({ start = uv.hrtime(), title = title }, { __index = Timer })
|
|
end
|
|
|
|
---@return nil
|
|
function Timer:finish()
|
|
if not config.debug then
|
|
return
|
|
end
|
|
self.elapsed = (uv.hrtime() - self.start) / 1000000000
|
|
log.debug(("[%s] takes %.3f seconds"):format(self.title, self.elapsed))
|
|
end
|
|
|
|
return Timer
|