fix(telescope): replace anonymous functions in mappings by named functions (#1294)

This commit is contained in:
Maria José Solano 2023-09-28 02:08:43 -07:00 committed by GitHub
parent 74786c21d7
commit 13bf7977a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -165,48 +165,47 @@ return {
desc = "Goto Symbol (Workspace)", desc = "Goto Symbol (Workspace)",
}, },
}, },
opts = { opts = function()
defaults = { local actions = require("telescope.actions")
prompt_prefix = "",
selection_caret = "", local open_with_trouble = function(...)
mappings = { return require("trouble.providers.telescope").open_with_trouble(...)
i = { end
["<c-t>"] = function(...) local open_selected_with_trouble = function(...)
return require("trouble.providers.telescope").open_with_trouble(...) return require("trouble.providers.telescope").open_selected_with_trouble(...)
end, end
["<a-t>"] = function(...) local find_files_no_ignore = function()
return require("trouble.providers.telescope").open_selected_with_trouble(...) local action_state = require("telescope.actions.state")
end, local line = action_state.get_current_line()
["<a-i>"] = function() Util.telescope("find_files", { no_ignore = true, default_text = line })()
local action_state = require("telescope.actions.state") end
local line = action_state.get_current_line() local find_files_with_hidden = function()
Util.telescope("find_files", { no_ignore = true, default_text = line })() local action_state = require("telescope.actions.state")
end, local line = action_state.get_current_line()
["<a-h>"] = function() Util.telescope("find_files", { hidden = true, default_text = line })()
local action_state = require("telescope.actions.state") end
local line = action_state.get_current_line()
Util.telescope("find_files", { hidden = true, default_text = line })() return {
end, defaults = {
["<C-Down>"] = function(...) prompt_prefix = "",
return require("telescope.actions").cycle_history_next(...) selection_caret = "",
end, mappings = {
["<C-Up>"] = function(...) i = {
return require("telescope.actions").cycle_history_prev(...) ["<c-t>"] = open_with_trouble,
end, ["<a-t>"] = open_selected_with_trouble,
["<C-f>"] = function(...) ["<a-i>"] = find_files_no_ignore,
return require("telescope.actions").preview_scrolling_down(...) ["<a-h>"] = find_files_with_hidden,
end, ["<C-Down>"] = actions.cycle_history_next,
["<C-b>"] = function(...) ["<C-Up>"] = actions.cycle_history_prev,
return require("telescope.actions").preview_scrolling_up(...) ["<C-f>"] = actions.preview_scrolling_down,
end, ["<C-b>"] = actions.preview_scrolling_up,
}, },
n = { n = {
["q"] = function(...) ["q"] = actions.close,
return require("telescope.actions").close(...) },
end,
}, },
}, },
}, }
}, },
}, },