mirror of
https://github.com/zoriya/telescope.nvim.git
synced 2026-06-07 12:45:12 +00:00
[WIP]: Tue 15 Sep 2020 10:22:06 PM EDT
This commit is contained in:
@@ -117,13 +117,14 @@ builtin.live_grep = function(opts)
|
||||
|
||||
return flatten { conf.vimgrep_arguments, prompt }
|
||||
end,
|
||||
opts.entry_maker or make_entry.gen_from_vimgrep(opts),
|
||||
opts.max_results or 1000
|
||||
opts.entry_maker or make_entry.gen_from_vimgrep(opts)
|
||||
-- opts.max_results or 10
|
||||
)
|
||||
|
||||
pickers.new(opts, {
|
||||
prompt = 'Live Grep',
|
||||
finder = live_grepper,
|
||||
sorter = sorters.get_generic_fuzzy_sorter(opts),
|
||||
previewer = previewers.vimgrep.new(opts),
|
||||
}):find()
|
||||
end
|
||||
|
||||
@@ -639,9 +639,9 @@ pickers.entry_manager = function(max_results, set_entry)
|
||||
return setmetatable({
|
||||
add_entry = function(self, score, entry)
|
||||
assert(type(entry) == "table", "entry must be a table by the time it reaches here")
|
||||
|
||||
score = score or 0
|
||||
|
||||
-- O(n) in worst case, actual worst case is max_results
|
||||
for index, item in ipairs(entry_state) do
|
||||
if item.score > score then
|
||||
return self:insert(index, {
|
||||
@@ -679,7 +679,7 @@ pickers.entry_manager = function(max_results, set_entry)
|
||||
|
||||
index = index + 1
|
||||
entry = next_entry
|
||||
until not next_entry
|
||||
until not next_entry or index > max_results
|
||||
end,
|
||||
|
||||
num_results = function()
|
||||
|
||||
@@ -11,7 +11,7 @@ local request_id_to_picker = setmetatable({}, {
|
||||
local max_entry_id = 0
|
||||
local entry_id_to_entry = {}
|
||||
|
||||
local worker_func = function(path, bound_request_id, entry_id, prompt, entry)
|
||||
local function worker_func(path, bound_request_id, entry_id, prompt, entry)
|
||||
package.path = path
|
||||
|
||||
if not FuzzySorter then
|
||||
@@ -21,7 +21,7 @@ local worker_func = function(path, bound_request_id, entry_id, prompt, entry)
|
||||
return bound_request_id, entry_id, pcall(FuzzySorter.score, FuzzySorter, prompt, entry)
|
||||
end
|
||||
|
||||
local after_func = function(bound_request_id, entry_id, score_ok, sort_score)
|
||||
local function after_func(bound_request_id, entry_id, score_ok, sort_score)
|
||||
local picker = request_id_to_picker[bound_request_id]
|
||||
|
||||
if picker._requests_id ~= bound_request_id or bound_request_id ~= current_request_id then
|
||||
|
||||
@@ -1,45 +1,46 @@
|
||||
RELOAD('plenary')
|
||||
RELOAD('telescope')
|
||||
require('plenary.reload').reload_module('plenary')
|
||||
require('plenary.reload').reload_module('telescope')
|
||||
|
||||
require('telescope')
|
||||
|
||||
local profiler = require('plenary.profile.lua_profiler')
|
||||
profiler = require('plenary.profile.lua_profiler')
|
||||
|
||||
local finders = require('telescope.finders')
|
||||
local make_entry = require('telescope.make_entry')
|
||||
local previewers = require('telescope.previewers')
|
||||
local pickers = require('telescope.pickers')
|
||||
local sorters = require('telescope.sorters')
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
PERF_DEBUG = 455
|
||||
vim.api.nvim_buf_set_lines(PERF_DEBUG, 0, -1, false, {})
|
||||
PERF_DEBUG = nil
|
||||
if PERF_DEBUG then
|
||||
vim.api.nvim_buf_set_lines(PERF_DEBUG, 0, -1, false, {})
|
||||
end
|
||||
|
||||
local cwd = vim.fn.expand("~/plugins/telescope.nvim")
|
||||
local cwd = vim.fn.expand("~/build/neovim")
|
||||
|
||||
profiler.start()
|
||||
|
||||
pickers.new {
|
||||
prompt = 'Large search',
|
||||
finder = finders.new_oneshot_job(
|
||||
{"fdfind"},
|
||||
{
|
||||
cwd = cwd,
|
||||
entry_maker = make_entry.gen_from_file {cwd = cwd},
|
||||
-- disable_devicons = true,
|
||||
-- maximum_results = 1000,
|
||||
}
|
||||
),
|
||||
sorter = sorters.get_fuzzy_file(),
|
||||
previewer = previewers.cat.new{cwd = cwd},
|
||||
}:find()
|
||||
-- pickers.new {
|
||||
-- prompt = 'Large search',
|
||||
-- finder = finders.new_oneshot_job(
|
||||
-- {"fdfind"},
|
||||
-- {
|
||||
-- cwd = cwd,
|
||||
-- entry_maker = make_entry.gen_from_file {cwd = cwd},
|
||||
-- -- disable_devicons = true,
|
||||
-- -- maximum_results = 1000,
|
||||
-- }
|
||||
-- ),
|
||||
-- sorter = sorters.get_fuzzy_file(),
|
||||
-- previewer = previewers.cat.new{cwd = cwd},
|
||||
-- }:find()
|
||||
builtin.live_grep {
|
||||
max_results = 10,
|
||||
cwd = cwd,
|
||||
}
|
||||
|
||||
|
||||
COMPLETED = false
|
||||
print(vim.wait(3000, function()
|
||||
vim.cmd [[redraw!]]
|
||||
return COMPLETED
|
||||
end, 100))
|
||||
--[[
|
||||
profiler.stop()
|
||||
profiler.report('/home/tj/tmp/profiler_score.txt')
|
||||
-- vim.cmd [[bd!]]
|
||||
-- vim.cmd [[stopinsert]]
|
||||
--]]
|
||||
|
||||
Reference in New Issue
Block a user