summaryrefslogtreecommitdiff
path: root/lua/telescope/finders.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-08-31 18:12:51 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-08-31 18:12:51 -0400
commit8c5bf8c7467cf28da2ac5de4f2eaa966f02b2b48 (patch)
tree759150e002a4237cabea5469973323eb7d0cbe7c /lua/telescope/finders.lua
parente38589f265a276d431113efcef6fdb157120ce68 (diff)
wip: Messing around w/ ffi for some stuff
Diffstat (limited to 'lua/telescope/finders.lua')
-rw-r--r--lua/telescope/finders.lua19
1 files changed, 8 insertions, 11 deletions
diff --git a/lua/telescope/finders.lua b/lua/telescope/finders.lua
index ae32370..b3c5022 100644
--- a/lua/telescope/finders.lua
+++ b/lua/telescope/finders.lua
@@ -40,6 +40,7 @@ function Finder:new(opts)
local obj = setmetatable({
results = opts.results,
+ entry_maker = opts.entry_maker,
fn_command = opts.fn_command,
static = opts.static,
state = {},
@@ -95,24 +96,18 @@ function Finder:_find(prompt, process_result, process_complete)
-- TODO: Should consider ways to allow "transformers" to be run here.
-- So that a finder can choose to "transform" the text into something much more easily usable.
- local entries_processed = 0
-
local on_output = function(_, line, _)
if not line then
return
end
- if maximum_results then
- entries_processed = entries_processed + 1
- if entries_processed > maximum_results then
- log.info("Shutting down job early...")
- self.job:shutdown()
- end
- end
-
if vim.trim(line) ~= "" then
line = line:gsub("\n", "")
+ if self.entry_maker then
+ line = self.entry_maker(line)
+ end
+
process_result(line)
if self.static then
@@ -160,7 +155,7 @@ end
-- }
-- end
-finders.new_oneshot_job = function(command_list)
+finders.new_oneshot_job = function(command_list, entry_maker)
command_list = vim.deepcopy(command_list)
local command = table.remove(command_list, 1)
@@ -168,6 +163,8 @@ finders.new_oneshot_job = function(command_list)
return finders.new {
static = true,
+ entry_maker = entry_maker,
+
fn_command = function()
return {
command = command,