Skip to content

Commit

Permalink
fix: select always triggering when auto_show enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Saghen committed Oct 16, 2024
1 parent deaefd0 commit db635f2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lua/blink/cmp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,16 @@ cmp.select_and_accept = function()
vim.schedule(function()
-- select an item if none is selected
if not cmp.windows.autocomplete.get_selected_item() then cmp.windows.autocomplete.select_next() end

local item = cmp.windows.autocomplete.get_selected_item()
if item ~= nil then require('blink.cmp.accept')(item) end
end)
return true
end

cmp.select_prev = function()
if not cmp.windows.autocomplete.win:is_open() and not cmp.windows.autocomplete.auto_show then
if not cmp.windows.autocomplete.win:is_open() then
if cmp.windows.autocomplete.auto_show then return end
cmp.show()
return true
end
Expand All @@ -173,7 +175,8 @@ cmp.select_prev = function()
end

cmp.select_next = function()
if not cmp.windows.autocomplete.win:is_open() and not cmp.windows.autocomplete.auto_show then
if not cmp.windows.autocomplete.win:is_open() then
if cmp.windows.autocomplete.auto_show then return end
cmp.show()
return true
end
Expand Down

1 comment on commit db635f2

@Julian
Copy link

@Julian Julian commented on db635f2 Nov 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to figure out why auto_show isn't working for me (it doesn't show anything automatically, but does if I manually show_documentation via e.g. ctrl-space). Does this commit have a typo or am I missing something? Specifically isn't

    if cmp.windows.autocomplete.auto_show then return end

supposed to be

    if not cmp.windows.autocomplete.auto_show then return end

as it was previously?

Please sign in to comment.