Skip to content

Commit 7f5a3d9

Browse files
committed
fix: always hide window on accept
1 parent f62046a commit 7f5a3d9

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lua/blink/cmp/accept/init.lua

+3-7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ local brackets_lib = require('blink.cmp.accept.brackets')
44
--- Applies a completion item to the current buffer
55
--- @param item blink.cmp.CompletionItem
66
local function accept(item)
7+
require('blink.cmp.trigger.completion').hide()
8+
79
-- create an undo point
810
if require('blink.cmp.config').accept.create_undo_point then
911
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-g>u', true, true, true), 'n', true)
@@ -16,14 +18,8 @@ local function accept(item)
1618
local brackets_status, text_edit_with_brackets, offset = brackets_lib.add_brackets(vim.bo.filetype, item)
1719
item.textEdit = text_edit_with_brackets
1820

19-
local current_word = require('blink.cmp.trigger.completion').get_current_word()
20-
if current_word == item.textEdit.newText then
21-
-- Hide the completion window and don't apply the text edit because
22-
-- the new text is already inserted
23-
require('blink.cmp.trigger.completion').hide()
24-
2521
-- Snippet
26-
elseif item.insertTextFormat == vim.lsp.protocol.InsertTextFormat.Snippet then
22+
if item.insertTextFormat == vim.lsp.protocol.InsertTextFormat.Snippet then
2723
-- We want to handle offset_encoding and the text edit api can do this for us
2824
-- so we empty the newText and apply
2925
local temp_text_edit = vim.deepcopy(item.textEdit)

0 commit comments

Comments
 (0)