Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not setup more than once #3056

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lua/telescope/_extensions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local extensions = {}
extensions._loaded = {}
extensions._config = {}
extensions._health = {}
extensions._has_setup = {}

local load_extension = function(name)
local ok, ext = pcall(require, "telescope._extensions." .. name)
Expand All @@ -16,8 +17,9 @@ extensions.manager = setmetatable({}, {
__index = function(t, k)
local ext = load_extension(k)
t[k] = ext.exports or {}
if ext.setup then
if ext.setup and not extensions._has_setup[k] then
ext.setup(extensions._config[k] or {}, require("telescope.config").values)
extensions._has_setup[k] = true
end
extensions._health[k] = ext.health

Expand Down Expand Up @@ -60,8 +62,9 @@ end

extensions.load = function(name)
local ext = load_extension(name)
if ext.setup then
if ext.setup and not extensions._has_setup[name] then
ext.setup(extensions._config[name] or {}, require("telescope.config").values)
extensions._has_setup[name] = true
end
return extensions.manager[name]
end
Expand Down