From b1ecb75a6cf0bc83ec64d987c7f4128ada3c254e Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 30 May 2022 20:46:56 +1000 Subject: [PATCH] feat: guard against multiple setup calls (#1308) --- lua/nvim-tree.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 2b4f9604..0eb48841 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -16,7 +16,9 @@ local collapse_all = require "nvim-tree.actions.collapse-all" local _config = {} -local M = {} +local M = { + setup_called = false, +} function M.focus() M.open() @@ -561,6 +563,12 @@ function M.setup(conf) return end + if M.setup_called then + utils.warn "nvim-tree.lua setup called multiple times" + return + end + M.setup_called = true + legacy.migrate_legacy_options(conf or {}) validate_options(conf)