Skip to content

Commit 052d39f

Browse files
committed
docs(#3088): extract api/health.lua, tidy formatting
1 parent 2201bb0 commit 052d39f

7 files changed

Lines changed: 31 additions & 15 deletions

File tree

lua/nvim-tree/api.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,14 @@ Api.config.mappings.default_on_attach = Api.map.default_on_attach
392392

393393
end
394394

395-
Api.diagnostics.hi_test = wrap(appearance_hi_test)
395+
function Api.hydrate_health(health)
396+
Api.health = health
397+
398+
Api.health.hi_test = wrap(appearance_hi_test)
399+
400+
-- TODO #3088 legacy mappings have to go somewhere
401+
Api.diagnostics.hi_test = Api.health.hi_test
402+
end
396403

397404
Api.commands.get = wrap(function()
398405
return require("nvim-tree.commands").get()

lua/nvim-tree/api/filter.lua

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
---@meta
22
local nvim_tree = { api = { filter = { live_filter = {} } } }
33

4-
5-
4+
---
65
---Enter live filter mode. Opens an input window with [filetype] `NvimTreeFilter`
6+
---
77
function nvim_tree.api.filter.live_filter.start() end
88

9-
9+
---
1010
---Exit live filter mode.
11+
---
1112
function nvim_tree.api.filter.live_filter.clear() end
1213

13-
14-
1514
require("nvim-tree.api").hydrate_filter(nvim_tree.api.filter)
1615

1716
return nvim_tree.api.filter

lua/nvim-tree/api/health.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---@meta
2+
local nvim_tree = { api = { health = {} } }
3+
4+
---
5+
---Open a new buffer displaying all nvim-tree highlight groups, their link chain and concrete definition.
6+
---
7+
---Similar to `:so $VIMRUNTIME/syntax/hitest.vim` as per |:highlight|
8+
---
9+
function nvim_tree.api.health.hi_test() end
10+
11+
require("nvim-tree.api").hydrate_health(nvim_tree.api.health)
12+
13+
return nvim_tree.api.health

lua/nvim-tree/api/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
return {
22
filter = require("nvim-tree.api.filter"),
3+
health = require("nvim-tree.api.health"),
34
map = require("nvim-tree.api.map"),
45
tree = require("nvim-tree.api.tree"),
56
}

lua/nvim-tree/api/map.lua

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
---@meta
22
local nvim_tree = { api = { map = {} } }
33

4-
5-
4+
---
65
---Retrieve all buffer local mappings for nvim-tree. These are the mappings that are applied by [nvim_tree.Config] {on_attach}, which may include default mappings.
76
---
87
---@return vim.api.keyset.get_keymap[]
98
function nvim_tree.api.map.get_keymap() end
109

11-
12-
10+
---
1311
--- Retrieves the buffer local mappings for nvim-tree that are applied by [nvim_tree.api.map.default_on_attach()]
1412
---
1513
---@return vim.api.keyset.get_keymap[]
1614
function nvim_tree.api.map.get_keymap_default() end
1715

18-
19-
16+
---
2017
---Apply all [nvim-tree-mappings-default]. Call from your [nvim_tree.Config] {on_attach}.
2118
---
2219
---@param bufnr integer use the `bufnr` passed to {on_attach}
2320
function nvim_tree.api.map.default_on_attach(bufnr) end
2421

25-
26-
2722
require("nvim-tree.api").hydrate_map(nvim_tree.api.map)
2823

2924
return nvim_tree.api.map

lua/nvim-tree/commands.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ local CMDS = {
137137
desc = "nvim-tree: highlight test",
138138
},
139139
command = function()
140-
require("nvim-tree.api").diagnostics.hi_test()
140+
require("nvim-tree.api").health.hi_test()
141141
end,
142142
},
143143
}

scripts/gen_vimdoc_config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ local modules = {
3232
{ helptag = "nvim-tree-config-log", title = "Class: Config.Log", path = "./lua/nvim_tree/_meta/config/log.lua", },
3333

3434
{ helptag = "nvim-tree-api-filter", title = "Lua module: nvim_tree.api.filter", path = "./lua/nvim_tree/api/filter.lua", },
35+
{ helptag = "nvim-tree-api-health", title = "Lua module: nvim_tree.api.health", path = "./lua/nvim_tree/api/health.lua", },
3536
{ helptag = "nvim-tree-api-map", title = "Lua module: nvim_tree.api.map", path = "./lua/nvim_tree/api/map.lua", },
3637
{ helptag = "nvim-tree-api-tree", title = "Lua module: nvim_tree.api.tree", path = "./lua/nvim_tree/api/tree.lua", },
3738
}

0 commit comments

Comments
 (0)