]> Sergey Matveev's repositories - vim-lsp.git/commit
Make buffer completion responsive for large files
authorGirish Palya <girishji@gmail.com>
Sun, 25 Jun 2023 11:26:37 +0000 (13:26 +0200)
committerGirish Palya <girishji@gmail.com>
Sun, 25 Jun 2023 11:26:37 +0000 (13:26 +0200)
commit2791a6f18dd2befe6b064d070d66ca08faae64fd
treeb3fe4874262d9c4d0c8105f41123a0f9821bd56c
parent8338b7838e5d08999487dc89f81aea6f1054ffc3
Make buffer completion responsive for large files

Since buffer completion processes the current buffer everytime user
types something, it will degrade the experience for large files.

This change adds a timeout to buffer completor function. Processing
current buffer is cut short when timeout is exceeded. Setting
timeout to 0 will revert back to existing behaviour.

Default is set to 100 ms, good for scanning 6000 lines on M1 macbook.

It is possible to get fancy by scanning locality of cursor first
but such complication may not be worth the complexity.

Tested on >20k line files (I have to open these large C files
filled with hw specs occasionally).

M  autoload/lsp/completion.vim
M  autoload/lsp/options.vim
M  doc/lsp.txt
autoload/lsp/completion.vim
autoload/lsp/options.vim
doc/lsp.txt