p00f/nvim-ts-rainbow

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

  1. Open https://github.com/rouge8/jit.rs/blob/2a3e5dbc7d603f465c1f3083c655613d9a69b87d/tests/merge_test.rs#L147
  2. After line 147, type let tree = BTreeMap::from([
  3. Wait ~20 seconds after typing the [ before it appears.

Expected behavior

Text should insert instantly.

p00f commented

I can't reproduce this:

rust_slow.mp4
p00f commented

I even tried downloading the entire project, it inserts instantly

p00f commented

(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
p00f commented

I can reproduce this when I disable https://github.com/jiangmiao/auto-pairs

p00f commented

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

p00f commented

This might be related to steelsojka/pears.nvim#11 (comment)