Skip to content

Commit e9b5ca6

Browse files
committed
docs(#3088): old api is now impl, use new api
1 parent 9a8fb71 commit e9b5ca6

25 files changed

+438
-560
lines changed

doc/nvim-tree-lua.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2647,6 +2647,18 @@ toggle({node}) *nvim_tree.api.marks.toggle()*
26472647
==============================================================================
26482648
Lua module: nvim_tree.api.node *nvim-tree-api-node*
26492649

2650+
*ApiNodeDeleteWipeBufferOpts*
2651+
2652+
Fields: ~
2653+
{force} (`boolean?`) default false
2654+
2655+
*NodeEditOpts*
2656+
2657+
Fields: ~
2658+
• {quit_on_open} (`boolean?`) default false
2659+
{focus} (`boolean?`) default true
2660+
2661+
26502662
nvim_tree.api.node.buffer.delete() *nvim_tree.api.node.buffer.delete()*
26512663

26522664
nvim_tree.api.node.buffer.wipe() *nvim_tree.api.node.buffer.wipe()*
@@ -2911,6 +2923,9 @@ toggle({opts}) *nvim_tree.api.tree.toggle()*
29112923
|window-ID|, overrides {current_window}
29122924
• {find_file}? (`boolean`, default: false) Find the current
29132925
buffer.
2926+
• {update_root}? (`boolean`, default: false) Update root
2927+
following {find_file}, see
2928+
|nvim_tree.Config.UpdateFocusedFile| {update_root}
29142929
{focus}? (`boolean`, default: true) Focus the tree when
29152930
opening.
29162931

lua/nvim-tree.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -793,9 +793,6 @@ function M.setup(conf)
793793

794794
vim.g.NvimTreeSetup = 1
795795
vim.api.nvim_exec_autocmds("User", { pattern = "NvimTreeSetup" })
796-
797-
-- TODO #3088 remove this bootstrap once api/init.lua replaces old api.lua
798-
require("nvim-tree.api.init")
799796
end
800797

801798
vim.g.NvimTreeRequired = 1

lua/nvim-tree/_meta/api.lua

Lines changed: 0 additions & 16 deletions
This file was deleted.

lua/nvim-tree/_meta/api_decorator.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ local nvim_tree = { api = { decorator = {} } }
1212
---Names of builtin decorators or your decorator classes. Builtins are ordered lowest to highest priority.
1313
---@alias nvim_tree.api.decorator.Name "Git" | "Opened" | "Hidden" | "Modified" | "Bookmarks" | "Diagnostics" | "Copied" | "Cut" | nvim_tree.api.decorator.UserDecorator
1414

15+
---A string for rendering, with optional highlight groups to apply to it
16+
---@class (exact) nvim_tree.api.HighlightedString
17+
---@field str string
18+
---@field hl string[]
19+
1520
---Custom decorator, see :help nvim-tree-decorators
1621
---
1722
---@class (exact) nvim_tree.api.decorator.UserDecorator

lua/nvim-tree/actions/tree/find-file.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local finders_find_file = require("nvim-tree.actions.finders.find-file")
66
local M = {}
77

88
--- Find file or buffer
9-
---@param opts ApiTreeFindFileOpts|nil|boolean legacy -> opts.buf
9+
---@param opts nvim_tree.api.tree.find_file.Opts|nil|boolean legacy -> opts.buf
1010
function M.fn(opts)
1111
-- legacy arguments
1212
if type(opts) == "string" then

lua/nvim-tree/actions/tree/modifiers/collapse.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ end
2626

2727
---Collapse a node, root if nil
2828
---@param node Node?
29-
---@param opts ApiCollapseOpts
29+
---@param opts nvim_tree.api.tree.collapse.Opts
3030
local function collapse(node, opts)
3131
local explorer = core.get_explorer()
3232
if not explorer then
@@ -60,7 +60,7 @@ local function collapse(node, opts)
6060
end
6161

6262

63-
---@param opts ApiCollapseOpts|boolean|nil legacy -> opts.keep_buffers
63+
---@param opts nvim_tree.api.tree.collapse.Opts|boolean|nil legacy -> opts.keep_buffers
6464
function M.all(opts)
6565
-- legacy arguments
6666
if type(opts) == "boolean" then
@@ -73,7 +73,7 @@ function M.all(opts)
7373
end
7474

7575
---@param node Node
76-
---@param opts ApiCollapseOpts?
76+
---@param opts nvim_tree.api.tree.collapse.Opts?
7777
function M.node(node, opts)
7878
collapse(node, opts or {})
7979
end

lua/nvim-tree/actions/tree/modifiers/expand.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ local function gen_iterator(should_descend)
125125
end
126126

127127
---@param node Node?
128-
---@param expand_opts ApiTreeExpandOpts?
128+
---@param expand_opts nvim_tree.api.tree.expand.Opts?
129129
local function expand_node(node, expand_opts)
130130
if not node then
131131
return
@@ -141,14 +141,14 @@ end
141141

142142
---Expand the directory node or the root
143143
---@param node Node
144-
---@param expand_opts ApiTreeExpandOpts?
144+
---@param expand_opts nvim_tree.api.tree.expand.Opts?
145145
function M.all(node, expand_opts)
146146
expand_node(node and node:as(DirectoryNode) or core.get_explorer(), expand_opts)
147147
end
148148

149149
---Expand the directory node or parent node
150150
---@param node Node
151-
---@param expand_opts ApiTreeExpandOpts?
151+
---@param expand_opts nvim_tree.api.tree.expand.Opts?
152152
function M.node(node, expand_opts)
153153
if not node then
154154
return

lua/nvim-tree/actions/tree/open.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local finders_find_file = require("nvim-tree.actions.finders.find-file")
55
local M = {}
66

77
---Open the tree, focusing if already open.
8-
---@param opts ApiTreeOpenOpts|nil|string legacy -> opts.path
8+
---@param opts nvim_tree.api.tree.open.Opts|nil|string legacy -> opts.path
99
function M.fn(opts)
1010
-- legacy arguments
1111
if type(opts) == "string" then

lua/nvim-tree/actions/tree/resize.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ local view = require("nvim-tree.view")
33
local M = {}
44

55
---Resize the tree, persisting the new size.
6-
---@param opts ApiTreeResizeOpts|nil
6+
---@param opts nvim_tree.api.tree.resize.Opts|nil
77
function M.fn(opts)
88
if opts == nil then
99
-- reset to config values

lua/nvim-tree/actions/tree/toggle.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local finders_find_file = require("nvim-tree.actions.finders.find-file")
55
local M = {}
66

77
---Toggle the tree.
8-
---@param opts ApiTreeToggleOpts|nil|boolean legacy -> opts.find_file
8+
---@param opts nvim_tree.api.tree.toggle.Opts|nil|boolean legacy -> opts.find_file
99
---@param no_focus string|nil legacy -> opts.focus
1010
---@param cwd boolean|nil legacy -> opts.path
1111
---@param bang boolean|nil legacy -> opts.update_root

0 commit comments

Comments
 (0)