From ad6b15ee08f83d4a0ae273d1640c20fd0460ced3 Mon Sep 17 00:00:00 2001 From: hedy Date: Sun, 19 Nov 2023 22:35:07 +0800 Subject: [PATCH] refactor: Rename of most recent option --- CHANGELOG.md | 2 +- README.md | 12 ++++++------ lua/outline/config.lua | 4 ++-- lua/outline/docs.lua | 1 - lua/outline/folding.lua | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdcee63..9d89a5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,7 +59,7 @@ - New lua API function `is_focus_in_outline()` - Auto-unfold root nodes when there is only N nodes. Where N defaults to 1 (meaning when there is only 1 root node, keep it unfolded). The added config - option is `symbol_folding.auto_unfold_depth` with keys `hovered` and `only`. + option is `symbol_folding.auto_unfold` with keys `hovered` and `only`. Key `hovered` is the successor of the legacy `symbol_folding.auto_unfold_hover` option. **The old option would still work as expected.** diff --git a/README.md b/README.md index 5a9769f..bf5724a 100644 --- a/README.md +++ b/README.md @@ -254,7 +254,7 @@ Pass a table to the setup call with your configuration options. -- Depth past which nodes will be folded by default autofold_depth = nil, -- When to auto unfold nodes - auto_unfold_nodes = { + auto_unfold = { -- Auto unfold currently hovered symbol hovered = true, -- Auto fold when the root level only has this many nodes. @@ -736,7 +736,7 @@ Unfold all others except currently hovered item. ```lua symbol_folding = { autofold_depth = 1, - auto_unfold_nodes = { + auto_unfold = { hovered = true, }, }, @@ -747,23 +747,23 @@ symbol_folding = { ```lua symbol_folding = { - auto_unfold_nodes = { + auto_unfold = { only = 2, }, }, ``` -`auto_unfold_nodes.only = 2`: +`auto_unfold.only = 2`: https://github.com/hedyhli/outline.nvim/assets/50042066/035fadac-ecee-4427-9ee1-795dac215cea -`auto_unfold_nodes.only = 1`: +`auto_unfold.only = 1`: https://github.com/hedyhli/outline.nvim/assets/50042066/3a123b7e-ccf6-4278-9a8c-41d2e1865d83 In words "auto unfold nodes when there is only 2 nodes shown in the outline." -For `auto_unfold_nodes.only = true`: "auto unfold nodes when the root node is the only node left visible in the outline." +For `auto_unfold.only = true`: "auto unfold nodes when the root node is the only node left visible in the outline." ### Auto-jump diff --git a/lua/outline/config.lua b/lua/outline/config.lua index 83c4c06..b54d2d1 100644 --- a/lua/outline/config.lua +++ b/lua/outline/config.lua @@ -60,7 +60,7 @@ M.defaults = { }, symbol_folding = { autofold_depth = nil, - auto_unfold_nodes = { + auto_unfold = { hovered = true, ---@type boolean|integer only = true, @@ -311,7 +311,7 @@ function M.resolve_config() ----- SYMBOLS FILTER ----- M.resolve_filter_config() ----- AUTO UNFOLD ----- - local au = M.o.symbol_folding.auto_unfold_nodes + local au = M.o.symbol_folding.auto_unfold if M.o.symbol_folding.auto_unfold_hover == nil then if au.hovered ~= nil then M.o.symbol_folding.auto_unfold_hover = au.hovered diff --git a/lua/outline/docs.lua b/lua/outline/docs.lua index 1c0b85e..560747d 100644 --- a/lua/outline/docs.lua +++ b/lua/outline/docs.lua @@ -1,6 +1,5 @@ local Float = require('outline.float') local cfg = require('outline.config') -local providers = require('outline.providers') local utils = require('outline.utils') local M = {} diff --git a/lua/outline/folding.lua b/lua/outline/folding.lua index 8f59894..507c688 100644 --- a/lua/outline/folding.lua +++ b/lua/outline/folding.lua @@ -19,7 +19,7 @@ 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 + local only = cfg.o.symbol_folding.auto_unfold.only if node.folded ~= nil then return node.folded