mirror of
https://github.com/kristoferssolo/telescope-frecency.nvim.git
synced 2026-02-04 23:02:06 +00:00
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)
This commit is contained in:
committed by
GitHub
parent
1b1cf6aead
commit
1f32091e2b
@@ -1,29 +1,21 @@
|
||||
local telescope = (function()
|
||||
local ok, m = pcall(require, "telescope")
|
||||
if not ok then
|
||||
error "telescope-frecency: couldn't find telescope.nvim, please install"
|
||||
end
|
||||
return m
|
||||
end)()
|
||||
local frecency = require "frecency"
|
||||
|
||||
local picker = require "frecency.picker"
|
||||
|
||||
return telescope.register_extension {
|
||||
setup = picker.setup,
|
||||
return require("telescope").register_extension {
|
||||
setup = frecency.setup,
|
||||
health = function()
|
||||
if ({ pcall(require, "sqlite") })[1] then
|
||||
vim.health.report_ok "sql.nvim installed."
|
||||
if vim.F.npcall(require, "sqlite") then
|
||||
vim.health.ok "sqlite.lua installed."
|
||||
else
|
||||
vim.health.report_error "sql.nvim is required for telescope-frecency.nvim to work."
|
||||
vim.health.error "sqlite.lua is required for telescope-frecency.nvim to work."
|
||||
end
|
||||
if ({ pcall(require, "nvim-web-devicons") })[1] then
|
||||
vim.health.report_ok "nvim-web-devicons installed."
|
||||
if vim.F.npcall(require, "nvim-web-devicons") then
|
||||
vim.health.ok "nvim-web-devicons installed."
|
||||
else
|
||||
vim.health.report_info "nvim-web-devicons is not installed."
|
||||
vim.health.info "nvim-web-devicons is not installed."
|
||||
end
|
||||
end,
|
||||
exports = {
|
||||
frecency = picker.fd,
|
||||
complete = picker.complete,
|
||||
frecency = frecency.start,
|
||||
complete = frecency.complete,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user