mirror of
https://github.com/neovim/neovim.git
synced 2026-05-02 03:55:00 +00:00
fix(completion): wrong CompleteDone reason for auto-inserted sole match #38280
Problem: #38169 used compl_used_match to determine the CompleteDone reason, but this fires too broadly, it also changes the reason to "accept" when the popup was shown and the user dismissed it with <Esc> or <Space>, breaking snippet completion with autocomplete. Solution: Instead of checking compl_used_match in, check whether the pum was never shown (compl_match_array == NULL) in ins_compl_stop(). When a match was inserted but the pum never displayed, set the completed word so CompleteDone fires with reason "accept". This keeps the "discard" reason intact when the user dismisses a visible pum without confirming.
This commit is contained in:
@@ -1001,9 +1001,6 @@ describe('vim.lsp.completion: protocol', function()
|
||||
},
|
||||
},
|
||||
}
|
||||
exec_lua(function()
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
end)
|
||||
local client_id = create_server('dummy', completion_list)
|
||||
|
||||
exec_lua(function()
|
||||
@@ -1042,9 +1039,6 @@ describe('vim.lsp.completion: protocol', function()
|
||||
isIncomplete = false,
|
||||
items = { { label = 'hello' } },
|
||||
}
|
||||
exec_lua(function()
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
end)
|
||||
local client_id = create_server('dummy', completion_list, {
|
||||
resolve_result = {
|
||||
label = 'hello',
|
||||
|
||||
Reference in New Issue
Block a user