chore: delete unused functions (#1788)
* chore: delete unused functions * chore: remove unused file No one needs this WIP file as well. We already have all these pickers implemented in a better way
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
local make_entry = require "telescope.make_entry"
|
||||
local actions = require "telescope.actions"
|
||||
local action_state = require "telescope.actions.state"
|
||||
local finders = require "telescope.finders"
|
||||
local previewers = require "telescope.previewers"
|
||||
local pickers = require "telescope.pickers"
|
||||
local sorters = require "telescope.sorters"
|
||||
|
||||
local WIP = {}
|
||||
|
||||
WIP.git_diff = function()
|
||||
local file_picker = pickers.new {
|
||||
previewer = previewers.new_termopen {
|
||||
command = "git diff %s",
|
||||
},
|
||||
}
|
||||
|
||||
file_picker:find {
|
||||
prompt = "Git Diff Viewier",
|
||||
|
||||
finder = finders.new {
|
||||
static = true,
|
||||
|
||||
fn_command = function()
|
||||
return {
|
||||
command = "git",
|
||||
args = { "ls-files", "-m" },
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
sorter = sorters.get_norcalli_sorter(),
|
||||
}
|
||||
end
|
||||
|
||||
-- TODO: Make it so that when you select stuff, it's inserted
|
||||
-- TODO: Make it so the previewer shows the help text.
|
||||
WIP.completion = function(opts)
|
||||
local results = {}
|
||||
for k, _ in pairs(vim.api) do
|
||||
table.insert(results, k .. "()")
|
||||
end
|
||||
|
||||
local lsp_reference_finder = finders.new {
|
||||
results = results,
|
||||
}
|
||||
|
||||
-- TODO: Open the help text for the line.
|
||||
local reference_picker = pickers.new(opts, {
|
||||
prompt = "vim.api Help Reference",
|
||||
finder = lsp_reference_finder,
|
||||
sorter = sorters.get_norcalli_sorter(),
|
||||
previewer = previewers.help,
|
||||
})
|
||||
|
||||
reference_picker:find()
|
||||
end
|
||||
|
||||
WIP.reloader = function(opts)
|
||||
opts = opts or {}
|
||||
|
||||
pickers.new(opts, {
|
||||
prompt = "Packages",
|
||||
finder = finders.new_table {
|
||||
results = vim.tbl_keys(package.loaded),
|
||||
entry_maker = make_entry.gen_from_string(),
|
||||
},
|
||||
sorter = sorters.get_generic_fuzzy_sorter(),
|
||||
|
||||
attach_mappings = function(prompt_bufnr, map)
|
||||
local reload_package = function()
|
||||
local selection = action_state.get_selected_entry()
|
||||
|
||||
actions.close(prompt_bufnr)
|
||||
|
||||
print(vim.inspect(selection))
|
||||
end
|
||||
|
||||
map("i", "<CR>", reload_package)
|
||||
map("n", "<CR>", reload_package)
|
||||
|
||||
return true
|
||||
end,
|
||||
}):find()
|
||||
end
|
||||
|
||||
-- TODO: Use tree sitter to get "everything" in your current scope / file / etc.
|
||||
-- Fuzzy find ofver it, go to its definition.
|
||||
|
||||
return WIP
|
||||
@@ -36,25 +36,6 @@ utils.get_lazy_default = function(x, defaulter, ...)
|
||||
end
|
||||
end
|
||||
|
||||
local function reversedipairsiter(t, i)
|
||||
i = i - 1
|
||||
if i ~= 0 then
|
||||
return i, t[i]
|
||||
end
|
||||
end
|
||||
|
||||
utils.reversed_ipairs = function(t)
|
||||
return reversedipairsiter, t, #t + 1
|
||||
end
|
||||
|
||||
utils.default_table_mt = {
|
||||
__index = function(t, k)
|
||||
local obj = {}
|
||||
rawset(t, k, obj)
|
||||
return obj
|
||||
end,
|
||||
}
|
||||
|
||||
utils.repeated_table = function(n, val)
|
||||
local empty_lines = {}
|
||||
for _ = 1, n do
|
||||
@@ -63,33 +44,6 @@ utils.repeated_table = function(n, val)
|
||||
return empty_lines
|
||||
end
|
||||
|
||||
utils.quickfix_items_to_entries = function(locations)
|
||||
local results = {}
|
||||
|
||||
for _, entry in ipairs(locations) do
|
||||
local vimgrep_str = entry.vimgrep_str
|
||||
or string.format(
|
||||
"%s:%s:%s: %s",
|
||||
vim.fn.fnamemodify(entry.display_filename or entry.filename, ":."),
|
||||
entry.lnum,
|
||||
entry.col,
|
||||
entry.text
|
||||
)
|
||||
|
||||
table.insert(results, {
|
||||
valid = true,
|
||||
value = entry,
|
||||
ordinal = vimgrep_str,
|
||||
display = vimgrep_str,
|
||||
|
||||
start = entry.start,
|
||||
finish = entry.finish,
|
||||
})
|
||||
end
|
||||
|
||||
return results
|
||||
end
|
||||
|
||||
utils.filter_symbols = function(results, opts)
|
||||
local has_ignore = opts.ignore_symbols ~= nil
|
||||
local has_symbols = opts.symbols ~= nil
|
||||
|
||||
Reference in New Issue
Block a user