Skip to content

Commit a4b86b9

Browse files
committed
refactor(#3255): ensure all args passed to api
1 parent 6485948 commit a4b86b9

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

lua/nvim-tree/api/impl/post.lua

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ function M.hydrate(api)
105105
api.fs.rename_sub = _n(function(n) require("nvim-tree.actions").fs.rename_file.rename_sub(n) end)
106106
api.fs.trash = _v(function(n) require("nvim-tree.actions").fs.trash.fn(n) end)
107107

108+
api.git.reload = e_(function(e) e:reload_git() end)
109+
108110
api.map.keymap.current = __(function() return require("nvim-tree.keymap").get_keymap() end)
109111

110112
api.marks.bulk.delete = e_(function(e) e.marks:bulk_delete() end)
@@ -163,22 +165,22 @@ function M.hydrate(api)
163165
api.tree.close = __(function() require("nvim-tree.view").close() end)
164166
api.tree.close_in_all_tabs = __(function() require("nvim-tree.view").close_all_tabs() end)
165167
api.tree.close_in_this_tab = __(function() require("nvim-tree.view").close_this_tab_only() end)
166-
api.tree.collapse_all = __(function() require("nvim-tree.actions").tree.collapse.all() end)
168+
api.tree.collapse_all = __(function(opts) require("nvim-tree.actions").tree.collapse.all(opts) end)
167169
api.tree.expand_all = en(function(e, n, opts) e:expand_all(n, opts) end)
168-
api.tree.find_file = __(function() require("nvim-tree.actions").tree.find_file.fn() end)
169-
api.tree.focus = __(function() require("nvim-tree.actions").tree.open.fn() end)
170+
api.tree.find_file = __(function(opts) require("nvim-tree.actions").tree.find_file.fn(opts) end)
171+
api.tree.focus = __(function(opts) require("nvim-tree.actions").tree.open.fn(opts) end)
170172
api.tree.get_node_under_cursor = en(function(e) return e:get_node_at_cursor() end)
171173
api.tree.get_nodes = en(function(e) return e:get_nodes() end)
172-
api.tree.is_tree_buf = __(function() return require("nvim-tree.utils").is_nvim_tree_buf() end)
173-
api.tree.is_visible = __(function() return require("nvim-tree.view").is_visible() end)
174-
api.tree.open = __(function() require("nvim-tree.actions").tree.open.fn() end)
174+
api.tree.is_tree_buf = __(function(bufnr) return require("nvim-tree.utils").is_nvim_tree_buf(bufnr) end)
175+
api.tree.is_visible = __(function(opts) return require("nvim-tree.view").is_visible(opts) end)
176+
api.tree.open = __(function(opts) require("nvim-tree.actions").tree.open.fn(opts) end)
175177
api.tree.reload = e_(function(e) e:reload_explorer() end)
176178
api.tree.reload_git = e_(function(e) e:reload_git() end)
177-
api.tree.resize = __(function() require("nvim-tree.actions").tree.resize.fn() end)
179+
api.tree.resize = __(function(opts) require("nvim-tree.actions").tree.resize.fn(opts) end)
178180
api.tree.search_node = __(function() require("nvim-tree.actions").finders.search_node.fn() end)
179-
api.tree.toggle = __(function() require("nvim-tree.actions").tree.toggle.fn() end)
181+
api.tree.toggle = __(function(opts) require("nvim-tree.actions").tree.toggle.fn(opts) end)
180182
api.tree.toggle_help = __(function() require("nvim-tree.help").toggle() end)
181-
api.tree.winid = __(function() return require("nvim-tree.view").winid() end)
183+
api.tree.winid = __(function(opts) return require("nvim-tree.view").winid(opts) end)
182184

183185
-- (Re)hydrate any legacy by mapping to concrete set above
184186
require("nvim-tree.legacy").map_api(api)

0 commit comments

Comments
 (0)