From 53d5b7959163d7ce5f31893a3be6bb845ee5fd80 Mon Sep 17 00:00:00 2001 From: Victor Ferreira da Silva Date: Mon, 5 Feb 2024 15:02:37 -0400 Subject: [PATCH] fix: checking for winid value before to evoke it (#203) * 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 --- lua/fidget/integration/nvim-tree.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/fidget/integration/nvim-tree.lua b/lua/fidget/integration/nvim-tree.lua index 89ab991..7bf42d8 100644 --- a/lua/fidget/integration/nvim-tree.lua +++ b/lua/fidget/integration/nvim-tree.lua @@ -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