Neovim freezes in large file when only opening bracket is inserted
rouge8 opened this issue · 9 comments
Describe the bug
I'm seeing extremely slow performance inserting ([
around line 150 in a ~1600 line file. It takes ~20 seconds for the [
to insert. 😵
Steps to reproduce
- Open https://github.com/rouge8/jit.rs/blob/2a3e5dbc7d603f465c1f3083c655613d9a69b87d/tests/merge_test.rs#L147
- After line 147, type
let tree = BTreeMap::from([
- Wait ~20 seconds after typing the
[
before it appears.
Expected behavior
Text should insert instantly.
I can't reproduce this:
rust_slow.mp4
I even tried downloading the entire project, it inserts instantly
(I do have rainbow enabled there, they are all different shades of blue/grey)
Interesting, it must be an interaction between plugins or something… I’ll try debugging more
I can still reproduce with a minimal set of plugins:
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate', 'branch': '0.5-compat'}
Plug 'p00f/nvim-ts-rainbow'
What looks different in your recording is that you're autocompleting the )
, so you're typing:
let tree = BTreeMap::from()
and then inserting the [
. Admittedly that still is slow for me...
And this is my Treesitter config:
lua <<EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained",
ignore_install = {},
highlight = {
enable = true,
disable = {"rst"},
additional_vim_regex_highlighting = false,
},
rainbow = {
enable = true,
extended_mode = true,
max_file_lines = nil,
},
matchup = {
enable = true,
},
}
EOF
I can reproduce this when I disable https://github.com/jiangmiao/auto-pairs
fwiw you can get around this without an autopair plugin by inserting the closing bracket first, and if you want to delete the brackets then delete the opening one first
This might be related to steelsojka/pears.nvim#11 (comment)