refactor: Rename of most recent option

This commit is contained in:
hedy
2023-11-19 22:35:07 +08:00
parent 4bc6bfc0dd
commit ad6b15ee08
5 changed files with 10 additions and 11 deletions

View File

@@ -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.**

View File

@@ -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

View File

@@ -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

View File

@@ -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 = {}

View File

@@ -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