Skip to content

Commit

Permalink
fix: checking for winid value before to evoke it (#203)
Browse files Browse the repository at this point in the history
* fix: checking for winid value before to evoke it

* fix(integration): check nvim-tree.api.tree.winid before registering callback

---------

Co-authored-by: j-hui <[email protected]>
  • Loading branch information
victorfds and j-hui authored Feb 5, 2024
1 parent a3e1e79 commit 53d5b79
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/fidget/integration/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ require("fidget.options").declare(M, "integration.nvim-tree", M.options, functio
end

local ok, api = pcall(function() return require("nvim-tree.api") end)
if not ok then
if not ok or not api.tree.winid then
-- NOTE: api.tree.winid doesn't exist on some older versions of nvim-tree.
-- We need it to figure out the size of the nvim-tree window, so if it does
-- not exist, there's no point in installing any nvim-tree event callbacks.
return
end

Expand Down

0 comments on commit 53d5b79

Please sign in to comment.