hedyhli / outline.nvim

Code outline sidebar powered by LSP. Forked from symbols-outline.nvim.
https://sr.ht/~hedy/outline.nvim
MIT License
645 stars 19 forks source link

Automatically re-enable auto-unfolding even after manual fold toggling #93

Open Giessen opened 2 months ago

Giessen commented 2 months ago

Description

After run fold_toggle on current node, the default behaviour of auto_unfold -ing others stops working.

Steps to reproduce: 1.Open outline window 2.Click to focus on one node with children underneath. We watched the node unfolding. OK. 3.Click to focus on second node with children underneath. We watched the second node unfolding, and previous node collapsing. OK. 4.Run fold_toggle (I set with Tab key in keymaps={...fold_toggle = {''}...}). Run again. We watched the second node collapsing and unfolding again. 5.Swtich focus back to the first node (in step 2). Expected: the second node would collapse. Reality: nothing happends with the second node (keep unfolded).

Neovim setup

Config:

keymaps = {
fold_toggle = {'<Tab>'},
},
symbol_folding = {
  auto_unfold = {
    hovered = true,
    only = 0, 
  },
},
hedyhli commented 2 months ago

Hi, manual folds (as the result of the folding key maps) are saved and they will not be affected by the auto-folding behaviour. They can be reset using the R key by default. Could you give it a try and see if that fixes auto-folding?

Giessen commented 2 months ago

I can confirm the R key resets the auto-folding.

Is there an option to keep the auto-folding behaviour after running fold_toggle (also fold_toggle_all), without pressing R key? IMHO, I find no reason to affect the auto-folding (:.

Thank you very much.

hedyhli commented 2 months ago

Hmm I see, I'll make this a feature request for now then.