summaryrefslogtreecommitdiff
path: root/lua/telescope/actions/init.lua
diff options
context:
space:
mode:
authorfdschmidt93 <39233597+fdschmidt93@users.noreply.github.com>2022-04-22 23:40:39 +0200
committerGitHub <noreply@github.com>2022-04-22 23:40:39 +0200
commit8b02088743c07c2f82aec2772fbd2b3774195448 (patch)
treee06cdbbec119f3de0ddc028d2b2c2a73d500f167 /lua/telescope/actions/init.lua
parentd743d70292956f55f4a71f291281287d206f29f2 (diff)
fix(which_key): get full path & handle table assignment of funcrefs (#1875)
Diffstat (limited to 'lua/telescope/actions/init.lua')
-rw-r--r--lua/telescope/actions/init.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/lua/telescope/actions/init.lua b/lua/telescope/actions/init.lua
index 03bd20c..be55390 100644
--- a/lua/telescope/actions/init.lua
+++ b/lua/telescope/actions/init.lua
@@ -1129,12 +1129,16 @@ actions.which_key = function(prompt_bufnr, opts)
elseif type(v.func) == "function" then
if not opts.only_show_current_mode or mode == v.mode then
local fname = action_utils._get_anon_function_name(v.func)
+ -- telescope.setup mappings might result in function names that reflect the keys
+ fname = fname:lower() == v.keybind:lower() and "<anonymous>" or fname
table.insert(mappings, { mode = v.mode, keybind = v.keybind, name = fname })
- utils.notify("actions.which_key", {
- msg = "No name available for anonymous functions.",
- level = "INFO",
- once = true,
- })
+ if fname == "<anonymous>" then
+ utils.notify("actions.which_key", {
+ msg = "No name available for anonymous functions.",
+ level = "INFO",
+ once = true,
+ })
+ end
end
end
end