Skip to content

Commit

Permalink
refactor: Rename of most recent option
Browse files Browse the repository at this point in the history
  • Loading branch information
hedyhli committed Nov 19, 2023
1 parent 4bc6bfc commit ad6b15e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.**

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -736,7 +736,7 @@ Unfold all others except currently hovered item.
```lua
symbol_folding = {
autofold_depth = 1,
auto_unfold_nodes = {
auto_unfold = {
hovered = true,
},
},
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lua/outline/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ M.defaults = {
},
symbol_folding = {
autofold_depth = nil,
auto_unfold_nodes = {
auto_unfold = {
hovered = true,
---@type boolean|integer
only = true,
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lua/outline/docs.lua
Original file line number Diff line number Diff line change
@@ -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 = {}
Expand Down
2 changes: 1 addition & 1 deletion lua/outline/folding.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ad6b15e

Please sign in to comment.