lsp icon indicating copy to clipboard operation
lsp copied to clipboard

:undo, :redo is incredibly slow when the change is big

Open kohnish opened this issue 4 years ago • 5 comments

Apply clang-format of totally different format like llvm in vim project. Undo the change, vim will completely get blocked with 100% usage for a while.

kohnish avatar Mar 10 '22 19:03 kohnish

Can you describe the sequence of steps and configuration that can be used to reproduce this problem?

yegappan avatar Mar 10 '22 20:03 yegappan

This might reproduce the issue.

# configure lsp with clangd in vimrc with compile commands json. (the step will be added if necessary)

# clang-format plugin
mkdir -p ~/.vim/pack/test/start
cd ~/.vim/pack/test/start
git clone https://github.com/rhysd/vim-clang-format.git

# checkout vim and generate compile commands json.
git clone https://github.com/vim/vim.git --depth=1
./configure
bear -- make -j
# Open c file in vim
vim src/userfunc.c
# clangformat in vim
:ClangFormat
# Undo the change
u
# Redo the change
ctrl + r

# vim gets stuck with 100% usage for a while for both u and ctrl + r.

kohnish avatar Mar 10 '22 21:03 kohnish

what's relevant to this lsp plugin?

Shane-XB-Qian avatar Mar 11 '22 01:03 Shane-XB-Qian

Thanks for the steps. I am able to reproduce the issue. It looks like when you undo all the edits, Vim invokes too many text changed notifications. I will look into this later.

yegappan avatar Mar 11 '22 04:03 yegappan

~~@yegappan not sure if relevant or not, since i did not use those plugins,, but i do was thinking the 7x24 compl perhaps was triggered too much as long as textchangedi, as well as the lsp workload, specially it would re-trigger a no base char's complete() after <c-y> unless giving a <cr> with it.~~

UPDATE: I've forgot why i said that, but anyway after recent refactor, i thought performance had been improvement some.

Shane-XB-Qian avatar Mar 14 '22 10:03 Shane-XB-Qian