Skip to content

Commit

Permalink
fix: consider functions as snippet commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Saghen committed Dec 13, 2024
1 parent 6b67d16 commit d065c87
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lua/blink/cmp/keymap/apply.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function apply.keymap_to_current_buffer(keys_to_commands)
for key, commands in pairs(keys_to_commands) do
local has_snippet_command = false
for _, command in ipairs(commands) do
if vim.tbl_contains(snippet_commands, command) then has_snippet_command = true end
if vim.tbl_contains(snippet_commands, command) or type(command) == 'function' then has_snippet_command = true end
end
if not has_snippet_command or #commands == 0 then goto continue end

Expand All @@ -51,11 +51,11 @@ function apply.keymap_to_current_buffer(keys_to_commands)
if command == 'fallback' then
return fallback()

-- run user defined functions
-- run user defined functions
elseif type(command) == 'function' then
if command(require('blink.cmp')) then return end

-- only run snippet commands
-- only run snippet commands
elseif vim.tbl_contains(snippet_commands, command) then
local did_run = require('blink.cmp')[command]()
if did_run then return end
Expand Down

0 comments on commit d065c87

Please sign in to comment.