chore: remove redundant run_builtin action (#1589)
This commit is contained in:
@@ -1001,7 +1001,6 @@ builtin.builtin({opts}) *builtin.builtin()*
|
|||||||
{opts} (table) options to pass to the picker
|
{opts} (table) options to pass to the picker
|
||||||
|
|
||||||
Options: ~
|
Options: ~
|
||||||
{ignore_filename} (boolean) dont show filenames (default: true)
|
|
||||||
{include_extensions} (boolean) if true will show the pickers of the
|
{include_extensions} (boolean) if true will show the pickers of the
|
||||||
installed extensions (default: false)
|
installed extensions (default: false)
|
||||||
|
|
||||||
|
|||||||
@@ -336,26 +336,6 @@ actions.paste_register = function(prompt_bufnr)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
actions.run_builtin = function(prompt_bufnr)
|
|
||||||
local selection = action_state.get_selected_entry()
|
|
||||||
if selection == nil then
|
|
||||||
print "[telescope] Nothing currently selected"
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
actions._close(prompt_bufnr, true)
|
|
||||||
if string.match(selection.text, " : ") then
|
|
||||||
-- Call appropriate function from extensions
|
|
||||||
local split_string = vim.split(selection.text, " : ")
|
|
||||||
local ext = split_string[1]
|
|
||||||
local func = split_string[2]
|
|
||||||
require("telescope").extensions[ext][func]()
|
|
||||||
else
|
|
||||||
-- Call appropriate telescope builtin
|
|
||||||
require("telescope.builtin")[selection.text]()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
actions.insert_symbol = function(prompt_bufnr)
|
actions.insert_symbol = function(prompt_bufnr)
|
||||||
local symbol = action_state.get_selected_entry().value[1]
|
local symbol = action_state.get_selected_entry().value[1]
|
||||||
actions.close(prompt_bufnr)
|
actions.close(prompt_bufnr)
|
||||||
|
|||||||
@@ -215,7 +215,6 @@ builtin.git_stash = require_on_exported_call("telescope.builtin.git").stash
|
|||||||
|
|
||||||
--- Lists all of the community maintained pickers built into Telescope
|
--- Lists all of the community maintained pickers built into Telescope
|
||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field ignore_filename boolean: dont show filenames (default: true)
|
|
||||||
---@field include_extensions boolean: if true will show the pickers of the installed extensions (default: false)
|
---@field include_extensions boolean: if true will show the pickers of the installed extensions (default: false)
|
||||||
builtin.builtin = require_on_exported_call("telescope.builtin.internal").builtin
|
builtin.builtin = require_on_exported_call("telescope.builtin.internal").builtin
|
||||||
|
|
||||||
|
|||||||
@@ -31,12 +31,7 @@ end
|
|||||||
|
|
||||||
local internal = {}
|
local internal = {}
|
||||||
|
|
||||||
-- TODO: What the heck should we do for accepting this.
|
|
||||||
-- vim.fn.setreg("+", "nnoremap $TODO :lua require('telescope.builtin').<whatever>()<CR>")
|
|
||||||
-- TODO: Can we just do the names instead?
|
|
||||||
internal.builtin = function(opts)
|
internal.builtin = function(opts)
|
||||||
opts.path_display = utils.get_default(opts.path_display, "hidden")
|
|
||||||
opts.ignore_filename = utils.get_default(opts.ignore_filename, true)
|
|
||||||
opts.include_extensions = utils.get_default(opts.include_extensions, false)
|
opts.include_extensions = utils.get_default(opts.include_extensions, false)
|
||||||
|
|
||||||
local objs = {}
|
local objs = {}
|
||||||
@@ -84,7 +79,27 @@ internal.builtin = function(opts)
|
|||||||
previewer = previewers.builtin.new(opts),
|
previewer = previewers.builtin.new(opts),
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
attach_mappings = function(_)
|
attach_mappings = function(_)
|
||||||
actions.select_default:replace(actions.run_builtin)
|
actions.select_default:replace(function(_)
|
||||||
|
local selection = action_state.get_selected_entry()
|
||||||
|
if not selection then
|
||||||
|
print "[telescope] Nothing currently selected"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- we do this to avoid any surprises
|
||||||
|
opts.include_extensions = nil
|
||||||
|
|
||||||
|
if string.match(selection.text, " : ") then
|
||||||
|
-- Call appropriate function from extensions
|
||||||
|
local split_string = vim.split(selection.text, " : ")
|
||||||
|
local ext = split_string[1]
|
||||||
|
local func = split_string[2]
|
||||||
|
require("telescope").extensions[ext][func](opts)
|
||||||
|
else
|
||||||
|
-- Call appropriate telescope builtin
|
||||||
|
require("telescope.builtin")[selection.text](opts)
|
||||||
|
end
|
||||||
|
end)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
}):find()
|
||||||
|
|||||||
Reference in New Issue
Block a user