feat: More auto-unfold options
Option to auto unfold when there is only N root nodes in outline. Defaults to 1, meaning if there is only one 'root' parent, it should always be unfolded. This is useful if the entire file is a single function or a single 'return'. The old auto_unfold_hover option **still works as expected**.
This commit is contained in:
@@ -18,9 +18,14 @@ end
|
||||
|
||||
---@param node outline.SymbolNode|outline.FlatSymbolNode
|
||||
function M.is_folded(node)
|
||||
local hover = cfg.o.symbol_folding.auto_unfold_hover
|
||||
local only = cfg.o.symbol_folding.auto_unfold_nodes.only
|
||||
|
||||
if node.folded ~= nil then
|
||||
return node.folded
|
||||
elseif node.hovered and cfg.o.symbol_folding.auto_unfold_hover then
|
||||
elseif node.parent.is_root and node.parent.child_count <= only then
|
||||
return false
|
||||
elseif node.hovered and hover then
|
||||
return false
|
||||
else
|
||||
return get_default_folded(node.depth)
|
||||
|
||||
Reference in New Issue
Block a user