Skip to content

Commit 470b5b6

Browse files
committed
refactor(#3255): ensure all args passed to api
1 parent 50cb22f commit 470b5b6

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

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

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

100+
api.git.reload = e_(function(e) e:reload_git() end)
101+
100102
api.map.keymap.current = __(function() return require("nvim-tree.keymap").get_keymap() end)
101103

102104
api.marks.bulk.delete = e_(function(e) e.marks:bulk_delete() end)
@@ -155,22 +157,22 @@ function M.hydrate(api)
155157
api.tree.close = __(function() require("nvim-tree.view").close() end)
156158
api.tree.close_in_all_tabs = __(function() require("nvim-tree.view").close_all_tabs() end)
157159
api.tree.close_in_this_tab = __(function() require("nvim-tree.view").close_this_tab_only() end)
158-
api.tree.collapse_all = __(function() require("nvim-tree.actions").tree.collapse.all() end)
160+
api.tree.collapse_all = __(function(opts) require("nvim-tree.actions").tree.collapse.all(opts) end)
159161
api.tree.expand_all = en(function(e, n, opts) e:expand_all(n, opts) end)
160-
api.tree.find_file = __(function() require("nvim-tree.actions").tree.find_file.fn() end)
161-
api.tree.focus = __(function() require("nvim-tree.actions").tree.open.fn() end)
162+
api.tree.find_file = __(function(opts) require("nvim-tree.actions").tree.find_file.fn(opts) end)
163+
api.tree.focus = __(function(opts) require("nvim-tree.actions").tree.open.fn(opts) end)
162164
api.tree.get_node_under_cursor = en(function(e) return e:get_node_at_cursor() end)
163165
api.tree.get_nodes = en(function(e) return e:get_nodes() end)
164-
api.tree.is_tree_buf = __(function() return require("nvim-tree.utils").is_nvim_tree_buf() end)
165-
api.tree.is_visible = __(function() return require("nvim-tree.view").is_visible() end)
166-
api.tree.open = __(function() require("nvim-tree.actions").tree.open.fn() end)
166+
api.tree.is_tree_buf = __(function(bufnr) return require("nvim-tree.utils").is_nvim_tree_buf(bufnr) end)
167+
api.tree.is_visible = __(function(opts) return require("nvim-tree.view").is_visible(opts) end)
168+
api.tree.open = __(function(opts) require("nvim-tree.actions").tree.open.fn(opts) end)
167169
api.tree.reload = e_(function(e) e:reload_explorer() end)
168170
api.tree.reload_git = e_(function(e) e:reload_git() end)
169-
api.tree.resize = __(function() require("nvim-tree.actions").tree.resize.fn() end)
171+
api.tree.resize = __(function(opts) require("nvim-tree.actions").tree.resize.fn(opts) end)
170172
api.tree.search_node = __(function() require("nvim-tree.actions").finders.search_node.fn() end)
171-
api.tree.toggle = __(function() require("nvim-tree.actions").tree.toggle.fn() end)
173+
api.tree.toggle = __(function(opts) require("nvim-tree.actions").tree.toggle.fn(opts) end)
172174
api.tree.toggle_help = __(function() require("nvim-tree.help").toggle() end)
173-
api.tree.winid = __(function() return require("nvim-tree.view").winid() end)
175+
api.tree.winid = __(function(opts) return require("nvim-tree.view").winid(opts) end)
174176

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

0 commit comments

Comments
 (0)