Skip to content

Commit

Permalink
deleted uneeded stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
oberblastmeister committed Mar 30, 2021
1 parent 068c91b commit be8d980
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
30 changes: 6 additions & 24 deletions lua/telescope/builtin/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -229,51 +229,33 @@ local function get_workspace_symbols_requester()
local cancel = function() end

return async(function(prompt_bufnr, prompt)
-- cancel()

local tx, rx = channel.oneshot()
cancel = vim.lsp.buf_request(prompt_bufnr, "workspace/symbol", {query = prompt}, tx)

local err, _, results_lsp = await(rx())
assert(not err, err)
-- dump(results_lsp)
-- assert(not err, err)
-- dump(await(rx()))

local locations = vim.lsp.util.symbols_to_items(results_lsp, prompt_bufnr) or {}
-- dump(locations)
-- local locations vim.tbl_map(function(result)
-- return
-- end, results_lsp)
-- dump(locations)
-- return locations
return locations
-- local locations = {}
-- for _, server_results in pairs(results_lsp) do
-- if server_results.result then
-- vim.list_extend(locations, vim.lsp.util.symbols_to_items(server_results.result, 0) or {})
-- end
-- end

-- return locations
end)
end

lsp.live_workspace_symbols = function(opts)
local curr_buf = vim.api.nvim_get_current_buf()

pickers.new(opts, {
prompt_title = 'LSP Workspace Symbols',
prompt_title = 'LSP Live Workspace Symbols',
finder = finders.new_live {
curr_buf = curr_buf,
entry_maker = opts.entry_maker or make_entry.gen_from_lsp_symbols(opts),
fn = get_workspace_symbols_requester(),
},
previewer = conf.qflist_previewer(opts),
sorter = conf.prefilter_sorter{
tag = "symbol_type",
sorter = conf.generic_sorter(opts)
}
sorter = conf.generic_sorter()
-- sorter = conf.prefilter_sorter{
-- tag = "symbol_type",
-- sorter = conf.generic_sorter(opts)
-- }
}):find()
end

Expand Down
14 changes: 2 additions & 12 deletions lua/telescope/finders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,31 +117,21 @@ function LiveFinder:new(opts)
curr_buf = opts.curr_buf,
fn = opts.fn,
entry_maker = opts.entry_maker or make_entry.from_string,
fn_command = opts.fn_command,
cwd = opts.cwd,
writer = opts.writer,

-- Maximum number of results to process.
-- Particularly useful for live updating large queries.
maximum_results = opts.maximum_results,
}, self)

return obj
end

function LiveFinder:_find(prompt, process_result, process_complete)
local fn = async(function()
a.scope(function()
local results = await(self.fn(self.curr_buf, prompt))
for _, result in ipairs(results) do
dump("processing result", result)
process_result(result)
process_result(self.entry_maker(result))
end

await(a.scheduler())
process_complete()
end)

a.util.run(fn())
end

local OneshotJobFinder = _callable_obj()
Expand Down

0 comments on commit be8d980

Please sign in to comment.