simrat39 / symbols-outline.nvim

A tree like view for symbols in Neovim using the Language Server Protocol. Supports all your favourite languages.
MIT License
1.85k stars 97 forks source link

fix(folding): optimize fold/unfold all #223

Open wjdwndud0114 opened 1 year ago

wjdwndud0114 commented 1 year ago

The previous recursive function repeatedly calls _update_lines() which is expensive. This makes my nvim freeze up even when working with smaller files; it's a terrible experience with larger files with a lot of symbol.

Changed it to an iterative algorithm and calling _update_lines() once at the end after the nodes have been updated. It should help with the memory usage too since the previous recursion wasn't tail call optimized.

fixes https://github.com/simrat39/symbols-outline.nvim/issues/224