mirror of
https://github.com/kristoferssolo/telescope-frecency.nvim.git
synced 2025-10-21 20:10:38 +00:00
refactor: remove logic for caching feature (#126)
It can get candidates sufficiently fast with the current logic. Remove logic for caching feature that still remained. ---- NOTE: My box has a DB containing 1284 files and 2973 timestamps. `:Telescope frecency` takes around 20 milliseconds on average.
This commit is contained in:
parent
2ac311a266
commit
07e0f87ebd
@ -5,6 +5,7 @@ local Finder = require "frecency.finder"
|
|||||||
local Picker = require "frecency.picker"
|
local Picker = require "frecency.picker"
|
||||||
local Recency = require "frecency.recency"
|
local Recency = require "frecency.recency"
|
||||||
local WebDevicons = require "frecency.web_devicons"
|
local WebDevicons = require "frecency.web_devicons"
|
||||||
|
local log = require "plenary.log"
|
||||||
|
|
||||||
---@class Frecency
|
---@class Frecency
|
||||||
---@field config FrecencyConfig
|
---@field config FrecencyConfig
|
||||||
@ -92,6 +93,8 @@ end
|
|||||||
---@param opts FrecencyPickerOptions?
|
---@param opts FrecencyPickerOptions?
|
||||||
---@return nil
|
---@return nil
|
||||||
function Frecency:start(opts)
|
function Frecency:start(opts)
|
||||||
|
local start = os.clock()
|
||||||
|
log.debug "Frecency:start"
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
self.picker = Picker.new(self.database, self.finder, self.fs, self.recency, {
|
self.picker = Picker.new(self.database, self.finder, self.fs, self.recency, {
|
||||||
default_workspace_tag = self.config.default_workspace,
|
default_workspace_tag = self.config.default_workspace,
|
||||||
@ -102,6 +105,7 @@ function Frecency:start(opts)
|
|||||||
workspaces = self.config.workspaces,
|
workspaces = self.config.workspaces,
|
||||||
})
|
})
|
||||||
self.picker:start(opts)
|
self.picker:start(opts)
|
||||||
|
log.debug(("Frecency:start picker:start takes %f seconds"):format(os.clock() - start))
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param findstart 1|0
|
---@param findstart 1|0
|
||||||
|
|||||||
@ -76,13 +76,9 @@ function Picker:start(opts)
|
|||||||
return self:default_path_display(picker_opts, path)
|
return self:default_path_display(picker_opts, path)
|
||||||
end,
|
end,
|
||||||
}, opts or {}) --[[@as FrecencyPickerOptions]]
|
}, opts or {}) --[[@as FrecencyPickerOptions]]
|
||||||
self.lsp_workspaces = {}
|
self.workspace = self:get_workspace(opts.cwd, self.config.initial_workspace_tag)
|
||||||
local workspace = self:get_workspace(opts.cwd, self.config.initial_workspace_tag)
|
log.debug { workspace = self.workspace }
|
||||||
log.debug { workspace = workspace, ["self.workspace"] = self.workspace }
|
self.results = self:fetch_results(self.workspace)
|
||||||
if vim.tbl_isempty(self.results) or workspace ~= self.workspace then
|
|
||||||
self.workspace = workspace
|
|
||||||
self.results = self:fetch_results(self.workspace)
|
|
||||||
end
|
|
||||||
|
|
||||||
local state = State.new()
|
local state = State.new()
|
||||||
|
|
||||||
@ -109,7 +105,7 @@ function Picker:start(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Picker:discard_results()
|
function Picker:discard_results()
|
||||||
self.results = {}
|
-- TODO: implement here when it needs to cache.
|
||||||
end
|
end
|
||||||
|
|
||||||
--- See :h 'complete-functions'
|
--- See :h 'complete-functions'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user