@@ -484,14 +484,16 @@ function mod.accept(modifier)
484484 end
485485
486486 -- Hack for 'autoindent', makes the indent persist. Check `:help 'autoindent'`.
487- vim .api .nvim_feedkeys (vim .api .nvim_replace_termcodes (" <Space><Left><Del>" , true , false , true ), " n" , false )
488- vim .lsp .util .apply_text_edits ({ { range = range , newText = newText } }, vim .api .nvim_get_current_buf (), " utf-16" )
489- -- Put cursor at the end of current line.
490- local cursor_keys = " <End>"
491- if has_nvim_0_10_x then
492- cursor_keys = string.rep (" <Down>" , # vim .split (newText , " \n " , { plain = true }) - 1 ) .. cursor_keys
493- end
494- vim .api .nvim_feedkeys (vim .api .nvim_replace_termcodes (cursor_keys , true , false , true ), " n" , false )
487+ vim .schedule_wrap (function ()
488+ vim .api .nvim_feedkeys (vim .api .nvim_replace_termcodes (" <Space><Left><Del>" , true , false , true ), " n" , false )
489+ vim .lsp .util .apply_text_edits ({ { range = range , newText = newText } }, vim .api .nvim_get_current_buf (), " utf-16" )
490+ -- Put cursor at the end of current line.
491+ local cursor_keys = " <End>"
492+ if has_nvim_0_10_x then
493+ cursor_keys = string.rep (" <Down>" , # vim .split (newText , " \n " , { plain = true }) - 1 ) .. cursor_keys
494+ end
495+ vim .api .nvim_feedkeys (vim .api .nvim_replace_termcodes (cursor_keys , true , false , true ), " n" , false )
496+ end )()
495497end
496498
497499function mod .accept_word ()
0 commit comments