Skip to content

Commit

Permalink
docs: add note about hack for luasnip on accept
Browse files Browse the repository at this point in the history
  • Loading branch information
Saghen committed Dec 18, 2024
1 parent 1563079 commit b3215b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/blink/cmp/completion/accept/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ local function accept(ctx, item, callback)
-- Create an undo point, if it's not a snippet, since the snippet engine should handle undo
if
ctx.mode == 'default'
and require('blink.cmp.config').completion.accept.create_undo_point
and item.insertTextFormat ~= vim.lsp.protocol.InsertTextFormat.Snippet
-- HACK: We check the kind here because the Luasnip source returns PlainText and handles
-- expansion itself. Otherwise, Luasnip will fail to enter select mode
-- https://github.com/Saghen/blink.cmp/commit/284dd37f9bbc632f8281d6361e877db5b45e6ff0#r150498482
and item.kind ~= require('blink.cmp.types').CompletionItemKind.Snippet
and require('blink.cmp.config').completion.accept.create_undo_point
then
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-g>u', true, true, true), 'n', true)
end
Expand Down

0 comments on commit b3215b6

Please sign in to comment.