66--- This is expensive as there are many cascading requires and is avoided
77--- until after setup has been called, so that the user may require API cheaply.
88
9- local view = require (" nvim-tree.view" )
109local actions = require (" nvim-tree.actions" )
10+ local help = require (" nvim-tree.help" )
11+ local keymap = require (" nvim-tree.keymap" )
12+ local utils = require (" nvim-tree.utils" )
13+ local view = require (" nvim-tree.view" )
1114
1215local DirectoryNode = require (" nvim-tree.node.directory" )
1316local FileLinkNode = require (" nvim-tree.node.file-link" )
@@ -131,7 +134,7 @@ local function open_or_expand_or_dir_up(mode, toggle_group)
131134end
132135
133136--- Hydrate all implementations barring those that were called during hydrate_pre
134- --- @param api table
137+ --- @param api table not properly typed to prevent LSP from referencing implementations
135138local function hydrate_post (api )
136139 api .tree .open = actions .tree .open .fn
137140 api .tree .focus = api .tree .open
@@ -157,8 +160,8 @@ local function hydrate_post(api)
157160 api .tree .collapse_all = actions .tree .collapse .all
158161
159162 api .tree .expand_all = wrap_node (wrap_explorer (" expand_all" ))
160- api .tree .toggle_help = function () require ( " nvim-tree. help" ) .toggle () end
161- api .tree .is_tree_buf = function () require ( " nvim-tree. utils" ) .is_nvim_tree_buf () end
163+ api .tree .toggle_help = help .toggle
164+ api .tree .is_tree_buf = utils .is_nvim_tree_buf
162165
163166 api .tree .is_visible = view .is_visible
164167
@@ -248,15 +251,15 @@ local function hydrate_post(api)
248251 api .marks .navigate .prev = wrap_explorer_member (" marks" , " navigate_prev" )
249252 api .marks .navigate .select = wrap_explorer_member (" marks" , " navigate_select" )
250253
251- api .map .get_keymap = function () require ( " nvim-tree. keymap" ) .get_keymap () end
254+ api .map .keymap . current = keymap .get_keymap
252255end
253256
254257--- Re-hydrate api
255- --- @param api table
258+ --- @param api table not properly typed to prevent LSP from referencing implementations
256259return function (api )
257260 -- All concrete implementations
258261 hydrate_post (api )
259262
260263 -- (Re)hydrate any legacy by mapping to function set above
261- require (" nvim-tree.legacy" ). api_map (api )
264+ require (" nvim-tree.api.impl. legacy" )(api )
262265end
0 commit comments