Skip to content

Commit da7caaa

Browse files
committed
fix(main):modify which-key usage API , compatible with different which-key versions
1 parent 269484c commit da7caaa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/astrocore/init.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,13 @@ function M.which_key_register()
232232
if M.which_key_queue then
233233
local wk_avail, wk = pcall(require, "which-key")
234234
if wk_avail then
235-
wk.add(M.which_key_queue)
235+
if type(wk.register) == "function" then
236+
wk.register(M.which_key_queue)
237+
elseif type(wk.add) == "function" then
238+
wk.add(M.which_key_queue)
239+
else
240+
vim.notify("The appropriate API for which-key was not found",vim.log.levels.ERROR)
241+
end
236242
M.which_key_queue = nil
237243
end
238244
end

0 commit comments

Comments
 (0)