Skip to content

Commit b3e8a63

Browse files
committed
docs(#3088): move node classes under api with logical order
1 parent 49b0b80 commit b3e8a63

5 files changed

Lines changed: 103 additions & 85 deletions

File tree

doc/nvim-tree-lua.txt

Lines changed: 71 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,9 +2379,9 @@ Example invocation of the `reload` function in the `tree` module: >lua
23792379
api.tree.reload()
23802380
<
23812381

2382-
Generally, functions accepting a {node} as their first argument will use the
2383-
node under the cursor when that argument is not present or nil. e.g. the
2384-
following are functionally identical: >lua
2382+
Generally, functions accepting a |nvim_tree.api.Node| as their first argument
2383+
will use the node under the cursor when that argument is not present or nil.
2384+
e.g. the following are functionally identical: >lua
23852385

23862386
api.node.open.edit(nil, { focus = true })
23872387

@@ -2390,6 +2390,74 @@ following are functionally identical: >lua
23902390

23912391

23922392

2393+
2394+
2395+
Base Node class:
2396+
2397+
2398+
*nvim_tree.api.Node*
2399+
Base Node, Abstract
2400+
2401+
Fields: ~
2402+
{type} (`"file"|"directory"|"link"`) uv.fs_stat.result.type
2403+
• {absolute_path} (`string`)
2404+
{executable} (`boolean`)
2405+
• {fs_stat}? (`uv.fs_stat.result`)
2406+
• {git_status}? (`GitNodeStatus`)
2407+
{hidden} (`boolean`)
2408+
{name} (`string`)
2409+
{parent}? (`nvim_tree.api.DirectoryNode`)
2410+
• {diag_severity}? (`lsp.DiagnosticSeverity`)
2411+
2412+
2413+
2414+
2415+
2416+
Node subclasses:
2417+
2418+
2419+
*nvim_tree.api.DirectoryLinkNode*
2420+
Extends: |nvim_tree.api.DirectoryNode|
2421+
2422+
DirectoryLink
2423+
2424+
*nvim_tree.api.DirectoryNode*
2425+
Extends: |nvim_tree.api.Node|
2426+
2427+
Directory
2428+
2429+
Fields: ~
2430+
• {has_children} (`boolean`)
2431+
{nodes} (`nvim_tree.api.Node[]`)
2432+
{open} (`boolean`)
2433+
2434+
*nvim_tree.api.FileLinkNode*
2435+
Extends: |nvim_tree.api.FileNode|
2436+
2437+
File Link
2438+
2439+
*nvim_tree.api.FileNode*
2440+
Extends: |nvim_tree.api.Node|
2441+
2442+
File
2443+
2444+
Fields: ~
2445+
{extension} (`string`)
2446+
2447+
*nvim_tree.api.LinkNode*
2448+
Link mixin
2449+
2450+
Fields: ~
2451+
• {link_to} (`string`)
2452+
• {fs_stat_target} (`uv.fs_stat.result`)
2453+
2454+
*nvim_tree.api.RootNode*
2455+
Extends: |nvim_tree.api.DirectoryNode|
2456+
2457+
Root Directory
2458+
2459+
2460+
23932461
==============================================================================
23942462
API: commands *nvim-tree-api-commands*
23952463

@@ -3149,66 +3217,4 @@ winid({opts}) *nvim_tree.api.tree.winid()*
31493217
(`integer?`) |window-ID|, nil if tree is not visible.
31503218

31513219

3152-
==============================================================================
3153-
API: Classes *nvim-tree-api-classes*
3154-
3155-
Classes shared by multiple API modules.
3156-
3157-
3158-
*nvim_tree.api.DirectoryLinkNode*
3159-
Extends: |nvim_tree.api.DirectoryNode|
3160-
3161-
DirectoryLink
3162-
3163-
*nvim_tree.api.DirectoryNode*
3164-
Extends: |nvim_tree.api.Node|
3165-
3166-
Directory
3167-
3168-
Fields: ~
3169-
• {has_children} (`boolean`)
3170-
{nodes} (`nvim_tree.api.Node[]`)
3171-
{open} (`boolean`)
3172-
3173-
*nvim_tree.api.FileLinkNode*
3174-
Extends: |nvim_tree.api.FileNode|
3175-
3176-
File Link
3177-
3178-
*nvim_tree.api.FileNode*
3179-
Extends: |nvim_tree.api.Node|
3180-
3181-
File
3182-
3183-
Fields: ~
3184-
{extension} (`string`)
3185-
3186-
*nvim_tree.api.LinkNode*
3187-
Link mixin
3188-
3189-
Fields: ~
3190-
• {link_to} (`string`)
3191-
• {fs_stat_target} (`uv.fs_stat.result`)
3192-
3193-
*nvim_tree.api.Node*
3194-
Base Node, Abstract
3195-
3196-
Fields: ~
3197-
{type} (`"file"|"directory"|"link"`) uv.fs_stat.result.type
3198-
• {absolute_path} (`string`)
3199-
{executable} (`boolean`)
3200-
• {fs_stat} (`uv.fs_stat.result?`)
3201-
• {git_status} (`GitNodeStatus?`)
3202-
{hidden} (`boolean`)
3203-
{name} (`string`)
3204-
{parent} (`nvim_tree.api.DirectoryNode?`)
3205-
• {diag_severity} (`lsp.DiagnosticSeverity?`)
3206-
3207-
*nvim_tree.api.RootNode*
3208-
Extends: |nvim_tree.api.DirectoryNode|
3209-
3210-
Root Directory
3211-
3212-
3213-
32143220
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---@meta
2+
3+
-- TODO #3088 document these
4+
5+
---@brief
6+
---Base Node class:
7+
---
8+
9+
---
10+
---Base Node, Abstract
11+
---
12+
---@class nvim_tree.api.Node
13+
---@field type "file" | "directory" | "link" uv.fs_stat.result.type
14+
---@field absolute_path string
15+
---@field executable boolean
16+
---@field fs_stat? uv.fs_stat.result
17+
---@field git_status? GitNodeStatus
18+
---@field hidden boolean
19+
---@field name string
20+
---@field parent? nvim_tree.api.DirectoryNode
21+
---@field diag_severity? lsp.DiagnosticSeverity
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,9 @@
33
-- TODO #3088 document these
44

55
---@brief
6-
---Classes shared by multiple API modules.
6+
---Node subclasses:
77
---
88

9-
---
10-
---Base Node, Abstract
11-
---
12-
---@class nvim_tree.api.Node
13-
---@field type "file" | "directory" | "link" uv.fs_stat.result.type
14-
---@field absolute_path string
15-
---@field executable boolean
16-
---@field fs_stat uv.fs_stat.result?
17-
---@field git_status GitNodeStatus?
18-
---@field hidden boolean
19-
---@field name string
20-
---@field parent nvim_tree.api.DirectoryNode?
21-
---@field diag_severity lsp.DiagnosticSeverity?
22-
239
---
2410
---File
2511
---

lua/nvim-tree/api.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ local api = {}
2525
---local api = require("nvim-tree.api")
2626
---api.tree.reload()
2727
---```
28-
---Generally, functions accepting a {node} as their first argument will use the node under the cursor when that argument is not present or nil. e.g. the following are functionally identical:
28+
---Generally, functions accepting a [nvim_tree.api.Node] as their first argument will use the node under the cursor when that argument is not present or nil. e.g. the following are functionally identical:
2929
---```lua
3030
---
3131
---api.node.open.edit(nil, { focus = true })

scripts/gen_vimdoc_config.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
---@field helptag string must be globally unique
77
---@field section string arbitrary
88
---@field path string relative to root
9-
---@field file_name string? generated from path
10-
---@field name string? override generated name
9+
---@field file_name? string generated from path
10+
---@field name? string override generated name
11+
---@field append_only? boolean follows previous section
1112

1213
---Help txt is deleted from first tag down and generated content is appended.
1314
---@type Src[]
@@ -39,6 +40,10 @@ local srcs = {
3940

4041
{ helptag = "nvim-tree-api", section = "API", path = "./lua/nvim_tree/api.lua", },
4142

43+
-- logically ordered classes with no section
44+
{ helptag = "xxx", section = "XXX", path = "./lua/nvim_tree/_meta/api/classes01.lua", append_only = true, },
45+
{ helptag = "xxx", section = "XXX", path = "./lua/nvim_tree/_meta/api/classes02.lua", append_only = true, },
46+
4247
{ helptag = "nvim-tree-api-commands", section = "API: commands", path = "./lua/nvim_tree/_meta/api/commands.lua", },
4348
{ helptag = "nvim-tree-api-events", section = "API: events", path = "./lua/nvim_tree/_meta/api/events.lua", },
4449
{ helptag = "nvim-tree-api-filter", section = "API: filter", path = "./lua/nvim_tree/_meta/api/filter.lua", },
@@ -51,8 +56,6 @@ local srcs = {
5156
{ helptag = "nvim-tree-api-node-navigate", section = "API: node.navigate", path = "./lua/nvim_tree/_meta/api/node/navigate.lua", },
5257
{ helptag = "nvim-tree-api-node-open", section = "API: node.open", path = "./lua/nvim_tree/_meta/api/node/open.lua", },
5358
{ helptag = "nvim-tree-api-tree", section = "API: tree", path = "./lua/nvim_tree/_meta/api/tree.lua", },
54-
55-
{ helptag = "nvim-tree-api-classes", section = "API: Classes", path = "./lua/nvim_tree/_meta/api/classes.lua", },
5659
}
5760

5861
-- hydrate file names
@@ -80,6 +83,8 @@ local config = {
8083
-- path
8184
files = vim.tbl_map(function(src) return src.path end, srcs),
8285

86+
append_only = vim.tbl_map(function(src) return src.append_only and src.file_name or nil end, srcs),
87+
8388
section_fmt = function(name)
8489
print(string.format("section_fmt name=%s", name))
8590
return srcs_by_name[name] and srcs_by_name[name].section or

0 commit comments

Comments
 (0)