Open delphinus opened 1 year ago
couldn't this not be resolved by just doing
extensions.load = function(name)
return extensions.manager[name]
end
that at least eliminates the case that load_extension
calls setup
twice in the same call stack and it still allows for lazy loading.
Description
When I call
require("telescope").load_extension "foo_bar"
, it seems extension'ssetup()
is called twice.load_extension()
is implemented like below in HEAD (2d92125).load_extension()
_extension.load()
https://github.com/nvim-telescope/telescope.nvim/blob/2d92125620417fbea82ec30303823e3cd69e90e8/lua/telescope/init.lua#L143-L143load()
calls extension'ssetup()
at the first time. https://github.com/nvim-telescope/telescope.nvim/blob/2d92125620417fbea82ec30303823e3cd69e90e8/lua/telescope/_extensions/init.lua#L62-L65manager
. https://github.com/nvim-telescope/telescope.nvim/blob/2d92125620417fbea82ec30303823e3cd69e90e8/lua/telescope/_extensions/init.lua#L66-L66manager
has a metatable, and it callssetup()
again by__index
entry. https://github.com/nvim-telescope/telescope.nvim/blob/2d92125620417fbea82ec30303823e3cd69e90e8/lua/telescope/_extensions/init.lua#L17-L21Neovim version
Operating system and version
macOS 13.4.1
Telescope version / branch / rev
2d92125
checkhealth telescope
Steps to reproduce
nvim -nu minimal.lua
:Telescope frecency
Expected behavior
extension's
setup()
should be called once.Actual behavior
extension's
setup()
is called twice.Minimal config