-
Notifications
You must be signed in to change notification settings - Fork 291
fix: accept after moving cursor while resolving #2022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I'm wondering about I investigated a bit and found that blink.cmp/lua/blink/cmp/completion/init.lua Lines 27 to 55 in bbdc399
UPD:
some logs from this diff: diff --git a/lua/blink/cmp/completion/init.lua b/lua/blink/cmp/completion/init.lua
index ce1866c..5980033 100644
--- a/lua/blink/cmp/completion/init.lua
+++ b/lua/blink/cmp/completion/init.lua
@@ -50,6 +50,7 @@ function completion.setup()
if not triggering_source_returned_items then return list.hide() end
end
+ print('cmp list show', vim.inspect(event.context.cursor), vim.inspect(trigger.context.cursor))
list.show(event.context, event.items)
end)
end)
diff --git a/lua/blink/cmp/sources/lib/init.lua b/lua/blink/cmp/sources/lib/init.lua
index fb97546..2d68bd3 100644
--- a/lua/blink/cmp/sources/lib/init.lua
+++ b/lua/blink/cmp/sources/lib/init.lua
@@ -159,6 +159,7 @@ function sources.emit_completions(context, _items_by_provider)
for id, items in pairs(_items_by_provider) do
if sources.providers[id]:should_show_items(context, items) then items_by_provider[id] = items end
end
+ print('emit_completions', vim.inspect(context.cursor))
sources.completions_emitter:emit({ context = context, items = items_by_provider })
end
diff --git a/lua/blink/cmp/sources/lib/tree.lua b/lua/blink/cmp/sources/lib/tree.lua
index 7f5bc61..3773fbb 100644
--- a/lua/blink/cmp/sources/lib/tree.lua
+++ b/lua/blink/cmp/sources/lib/tree.lua
@@ -93,6 +93,7 @@ function tree:get_completions(context, on_items_by_provider)
should_push_upstream = true
-- if atleast one of the results wasn't cached, emit the results
+ print('is_all_cached', is_all_cached, vim.inspect(context.cursor))
if not is_all_cached then self:emit_completions(items_by_provider, on_items_by_provider) end
end)
:catch(function(err) vim.print('failed to get completions with error: ' .. err) end) vtsls/ts_ls logs
rust_analyzer logs
luals with lazydev same as vtsls/ts_ls, this one you might be able to reproduce easily out.mp4 |
-- and set the cursor back to its position before accepting the item, since the snippet expansion | ||
-- inserts at the cursor position | ||
if not vim.api.nvim_get_mode().mode:match('i') then vim.cmd('startinsert') end | ||
vim.api.nvim_win_set_cursor(0, { ctx.cursor[1], ctx.cursor[2] }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not behave well if used after 59 row text_edits_lib.apply(temp_text_edit, all_text_edits)
in some cases
The user may exit insert mode and/or move the cursor after accepting an item while blink.cmp waits for the LSP resolve response.
Related to #1491 and #2018