From 5df2881500dec2687fef8825574d654f2e3b7ba6 Mon Sep 17 00:00:00 2001 From: hedy Date: Tue, 31 Oct 2023 21:06:50 +0800 Subject: [PATCH] fix(folding): Don't attempt to toggle non-foldable node --- lua/symbols-outline.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/symbols-outline.lua b/lua/symbols-outline.lua index 8c18567..734d182 100644 --- a/lua/symbols-outline.lua +++ b/lua/symbols-outline.lua @@ -122,7 +122,9 @@ function M._toggle_fold(move_cursor, node_index) local node = M.state.flattened_outline_items[node_index] or M._current_node() local is_folded = folding.is_folded(node) - M._set_folded(not is_folded, move_cursor, node_index) + if folding.is_foldable(node) then + M._set_folded(not is_folded, move_cursor, node_index) + end end function M._set_folded(folded, move_cursor, node_index)