|
8 | 8 | ---@class (exact) Src |
9 | 9 | ---@field helptag string must be globally unique |
10 | 10 | ---@field section string arbitrary |
11 | | ----@field path string relative to root |
| 11 | +---@field path string relative to cwd |
12 | 12 |
|
13 | | -local pre = "runtime/lua/nvim_tree/" |
| 13 | +local base = "runtime/lua/nvim_tree/" |
| 14 | +local placeholder = "runtime/lua/placeholder.lua" |
14 | 15 |
|
15 | 16 | ---@type Src[] |
16 | 17 | local srcs_config = { |
17 | | - { helptag = "nvim-tree-config", section = "Config", path = pre .. "_meta/config.lua", }, |
18 | | - |
19 | | - { helptag = "nvim-tree-config-sort", section = "Config: sort", path = pre .. "_meta/config/sort.lua", }, |
20 | | - { helptag = "nvim-tree-config-view", section = "Config: view", path = pre .. "_meta/config/view.lua", }, |
21 | | - { helptag = "nvim-tree-config-renderer", section = "Config: renderer", path = pre .. "_meta/config/renderer.lua", }, |
22 | | - { helptag = "nvim-tree-config-hijack-directories", section = "Config: hijack_directories", path = pre .. "_meta/config/hijack_directories.lua", }, |
23 | | - { helptag = "nvim-tree-config-update-focused-file", section = "Config: update_focused_file", path = pre .. "_meta/config/update_focused_file.lua", }, |
24 | | - { helptag = "nvim-tree-config-system-open", section = "Config: system_open", path = pre .. "_meta/config/system_open.lua", }, |
25 | | - { helptag = "nvim-tree-config-git", section = "Config: git", path = pre .. "_meta/config/git.lua", }, |
26 | | - { helptag = "nvim-tree-config-diagnostics", section = "Config: diagnostics", path = pre .. "_meta/config/diagnostics.lua", }, |
27 | | - { helptag = "nvim-tree-config-modified", section = "Config: modified", path = pre .. "_meta/config/modified.lua", }, |
28 | | - { helptag = "nvim-tree-config-filters", section = "Config: filters", path = pre .. "_meta/config/filters.lua", }, |
29 | | - { helptag = "nvim-tree-config-live-filter", section = "Config: live_filter", path = pre .. "_meta/config/live_filter.lua", }, |
30 | | - { helptag = "nvim-tree-config-filesystem-watchers", section = "Config: filesystem_watchers", path = pre .. "_meta/config/filesystem_watchers.lua", }, |
31 | | - { helptag = "nvim-tree-config-actions", section = "Config: actions", path = pre .. "_meta/config/actions.lua", }, |
32 | | - { helptag = "nvim-tree-config-trash", section = "Config: trash", path = pre .. "_meta/config/trash.lua", }, |
33 | | - { helptag = "nvim-tree-config-tab", section = "Config: tab", path = pre .. "_meta/config/tab.lua", }, |
34 | | - { helptag = "nvim-tree-config-notify", section = "Config: notify", path = pre .. "_meta/config/notify.lua", }, |
35 | | - { helptag = "nvim-tree-config-bookmarks", section = "Config: bookmarks", path = pre .. "_meta/config/bookmarks.lua", }, |
36 | | - { helptag = "nvim-tree-config-help", section = "Config: help", path = pre .. "_meta/config/help.lua", }, |
37 | | - { helptag = "nvim-tree-config-ui", section = "Config: ui", path = pre .. "_meta/config/ui.lua", }, |
38 | | - { helptag = "nvim-tree-config-experimental", section = "Config: experimental", path = pre .. "_meta/config/experimental.lua", }, |
39 | | - { helptag = "nvim-tree-config-log", section = "Config: log", path = pre .. "_meta/config/log.lua", }, |
40 | | - |
41 | | - { helptag = "nvim-tree-config-default", section = "Config: Default", path = pre .. "_meta/config/default.lua", }, |
42 | | - |
43 | | - { helptag = "nvim-tree-api", section = "PLACEHOLDER", path = "runtime/lua/placeholder.lua", }, |
| 18 | + { helptag = "nvim-tree-config", section = "Config", path = base .. "_meta/config.lua", }, |
| 19 | + |
| 20 | + { helptag = "nvim-tree-config-sort", section = "Config: sort", path = base .. "_meta/config/sort.lua", }, |
| 21 | + { helptag = "nvim-tree-config-view", section = "Config: view", path = base .. "_meta/config/view.lua", }, |
| 22 | + { helptag = "nvim-tree-config-renderer", section = "Config: renderer", path = base .. "_meta/config/renderer.lua", }, |
| 23 | + { helptag = "nvim-tree-config-hijack-directories", section = "Config: hijack_directories", path = base .. "_meta/config/hijack_directories.lua", }, |
| 24 | + { helptag = "nvim-tree-config-update-focused-file", section = "Config: update_focused_file", path = base .. "_meta/config/update_focused_file.lua", }, |
| 25 | + { helptag = "nvim-tree-config-system-open", section = "Config: system_open", path = base .. "_meta/config/system_open.lua", }, |
| 26 | + { helptag = "nvim-tree-config-git", section = "Config: git", path = base .. "_meta/config/git.lua", }, |
| 27 | + { helptag = "nvim-tree-config-diagnostics", section = "Config: diagnostics", path = base .. "_meta/config/diagnostics.lua", }, |
| 28 | + { helptag = "nvim-tree-config-modified", section = "Config: modified", path = base .. "_meta/config/modified.lua", }, |
| 29 | + { helptag = "nvim-tree-config-filters", section = "Config: filters", path = base .. "_meta/config/filters.lua", }, |
| 30 | + { helptag = "nvim-tree-config-live-filter", section = "Config: live_filter", path = base .. "_meta/config/live_filter.lua", }, |
| 31 | + { helptag = "nvim-tree-config-filesystem-watchers", section = "Config: filesystem_watchers", path = base .. "_meta/config/filesystem_watchers.lua", }, |
| 32 | + { helptag = "nvim-tree-config-actions", section = "Config: actions", path = base .. "_meta/config/actions.lua", }, |
| 33 | + { helptag = "nvim-tree-config-trash", section = "Config: trash", path = base .. "_meta/config/trash.lua", }, |
| 34 | + { helptag = "nvim-tree-config-tab", section = "Config: tab", path = base .. "_meta/config/tab.lua", }, |
| 35 | + { helptag = "nvim-tree-config-notify", section = "Config: notify", path = base .. "_meta/config/notify.lua", }, |
| 36 | + { helptag = "nvim-tree-config-bookmarks", section = "Config: bookmarks", path = base .. "_meta/config/bookmarks.lua", }, |
| 37 | + { helptag = "nvim-tree-config-help", section = "Config: help", path = base .. "_meta/config/help.lua", }, |
| 38 | + { helptag = "nvim-tree-config-ui", section = "Config: ui", path = base .. "_meta/config/ui.lua", }, |
| 39 | + { helptag = "nvim-tree-config-experimental", section = "Config: experimental", path = base .. "_meta/config/experimental.lua", }, |
| 40 | + { helptag = "nvim-tree-config-log", section = "Config: log", path = base .. "_meta/config/log.lua", }, |
| 41 | + |
| 42 | + { helptag = "nvim-tree-config-default", section = "Config: Default", path = base .. "_meta/config/default.lua", }, |
| 43 | + |
| 44 | + { helptag = "nvim-tree-api", section = "PLACEHOLDER", path = placeholder, }, |
44 | 45 | } |
45 | 46 |
|
46 | 47 | ---@type Src[] |
47 | 48 | local srcs_api = { |
48 | | - { helptag = "nvim-tree-api", section = "API", path = pre .. "api.lua", }, |
49 | | - |
50 | | - { helptag = "nvim-tree-api-commands", section = "API: commands", path = pre .. "_meta/api/commands.lua", }, |
51 | | - { helptag = "nvim-tree-api-events", section = "API: events", path = pre .. "_meta/api/events.lua", }, |
52 | | - { helptag = "nvim-tree-api-filter", section = "API: filter", path = pre .. "_meta/api/filter.lua", }, |
53 | | - { helptag = "nvim-tree-api-fs", section = "API: fs", path = pre .. "_meta/api/fs.lua", }, |
54 | | - { helptag = "nvim-tree-api-git", section = "API: git", path = pre .. "_meta/api/git.lua", }, |
55 | | - { helptag = "nvim-tree-api-health", section = "API: health", path = pre .. "_meta/api/health.lua", }, |
56 | | - { helptag = "nvim-tree-api-map", section = "API: map", path = pre .. "_meta/api/map.lua", }, |
57 | | - { helptag = "nvim-tree-api-marks", section = "API: marks", path = pre .. "_meta/api/marks.lua", }, |
58 | | - { helptag = "nvim-tree-api-node", section = "API: node", path = pre .. "_meta/api/node.lua", }, |
59 | | - { helptag = "nvim-tree-api-tree", section = "API: tree", path = pre .. "_meta/api/tree.lua", }, |
60 | | - |
61 | | - { helptag = "nvim-tree-class", section = "PLACEHOLDER", path = "runtime/lua/placeholder.lua", }, |
| 49 | + { helptag = "nvim-tree-api", section = "API", path = base .. "api.lua", }, |
| 50 | + |
| 51 | + { helptag = "nvim-tree-api-commands", section = "API: commands", path = base .. "_meta/api/commands.lua", }, |
| 52 | + { helptag = "nvim-tree-api-events", section = "API: events", path = base .. "_meta/api/events.lua", }, |
| 53 | + { helptag = "nvim-tree-api-filter", section = "API: filter", path = base .. "_meta/api/filter.lua", }, |
| 54 | + { helptag = "nvim-tree-api-fs", section = "API: fs", path = base .. "_meta/api/fs.lua", }, |
| 55 | + { helptag = "nvim-tree-api-git", section = "API: git", path = base .. "_meta/api/git.lua", }, |
| 56 | + { helptag = "nvim-tree-api-health", section = "API: health", path = base .. "_meta/api/health.lua", }, |
| 57 | + { helptag = "nvim-tree-api-map", section = "API: map", path = base .. "_meta/api/map.lua", }, |
| 58 | + { helptag = "nvim-tree-api-marks", section = "API: marks", path = base .. "_meta/api/marks.lua", }, |
| 59 | + { helptag = "nvim-tree-api-node", section = "API: node", path = base .. "_meta/api/node.lua", }, |
| 60 | + { helptag = "nvim-tree-api-tree", section = "API: tree", path = base .. "_meta/api/tree.lua", }, |
| 61 | + |
| 62 | + { helptag = "nvim-tree-class", section = "PLACEHOLDER", path = placeholder, }, |
62 | 63 | } |
63 | 64 |
|
64 | 65 | ---@type Src[] |
65 | 66 | local srcs_class = { |
66 | | - { helptag = "nvim-tree-class", section = "Class", path = pre .. "classic.lua", }, |
67 | | - { helptag = "nvim-tree-class-decorator", section = "Class: Decorator", path = pre .. "_meta/api/decorator.lua", }, |
68 | | - { helptag = "nvim-tree-class-decorator-example", section = "Class: Decorator: example", path = pre .. "_meta/api/decorator_example.lua", }, |
| 67 | + { helptag = "nvim-tree-class", section = "Class: Class", path = base .. "classic.lua", }, |
| 68 | + { helptag = "nvim-tree-class-decorator", section = "Class: Decorator", path = base .. "_meta/api/decorator.lua", }, |
| 69 | + { helptag = "nvim-tree-class-decorator-example", section = "Class: Decorator: example", path = base .. "_meta/api/decorator_example.lua", }, |
69 | 70 | } |
70 | 71 |
|
71 | 72 | ---Map paths to file names |
@@ -135,19 +136,17 @@ return { |
135 | 136 | section_fmt = function(name) return src_by_name(name, srcs_api).section end, |
136 | 137 | helptag_fmt = function(name) return src_by_name(name, srcs_api).helptag end, |
137 | 138 |
|
138 | | - -- strip module from the name |
139 | 139 | fn_xform = function(fun) |
140 | 140 | if (fun.module) then |
141 | 141 | normalise_module(fun) |
142 | 142 |
|
143 | | - -- remove the API prefix from the left aligned function name |
144 | | - -- this will cascade into fn_helptag_fmt, which will apply the module prefix anyway |
145 | | - local name, replaced = fun.name:gsub("^" .. fun.module .. "%.", "", 1) |
| 143 | + -- remove the module prefix from the left aligned function name |
| 144 | + -- default fn_helptag_fmt adds it back to the help tag |
| 145 | + local replaced |
| 146 | + fun.name, replaced = fun.name:gsub("^" .. fun.module .. "%.", "", 1) |
146 | 147 | if (replaced ~= 1) then |
147 | 148 | error(string.format("\n\nfun.name='%s' does not start with module\nfun=%s", fun.name, vim.inspect(fun))) |
148 | 149 | end |
149 | | - |
150 | | - fun.name = name |
151 | 150 | end |
152 | 151 | end, |
153 | 152 | }, |
|
0 commit comments