Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
74 lines
2.2 KiB
Lua
74 lines
2.2 KiB
Lua
local extensions = {}
|
|
|
|
extensions._loaded = {}
|
|
extensions._config = {}
|
|
extensions._health = {}
|
|
|
|
local load_extension = function(name)
|
|
local ok, ext = pcall(require, "telescope._extensions." .. name)
|
|
if not ok then
|
|
error(string.format("'%s' extension doesn't exist or isn't installed: %s", name, ext))
|
|
end
|
|
return ext
|
|
end
|
|
|
|
extensions.manager = setmetatable({}, {
|
|
__index = function(t, k)
|
|
local ext = load_extension(k)
|
|
t[k] = ext.exports or {}
|
|
if ext.setup then
|
|
ext.setup(extensions._config[k] or {}, require("telescope.config").values)
|
|
end
|
|
extensions._health[k] = ext.health
|
|
|
|
return t[k]
|
|
end,
|
|
})
|
|
|
|
--- Register an extension module.
|
|
---
|
|
--- Extensions have several important keys.
|
|
--- - setup:
|
|
--- function(ext_config, config) -> nil
|
|
---
|
|
--- Called when first loading the extension.
|
|
--- The first parameter is the config passed by the user
|
|
--- in telescope setup. The second parameter is the resulting
|
|
--- config.values after applying the users setup defaults.
|
|
---
|
|
--- It is acceptable for a plugin to override values in config,
|
|
--- as some plugins will be installed simply to manage some setup,
|
|
--- install some sorter, etc.
|
|
---
|
|
--- - exports:
|
|
--- table
|
|
---
|
|
--- Only the items in `exports` will be exposed on the resulting
|
|
--- module that users can access via require('telescope').extensions.foo
|
|
--- Also, any top-level key-value pairs in exports where the value is a function and the
|
|
--- key doesn't start with an underscore will be included when calling the `builtin` picker
|
|
--- with the `include_extensions` option enabled.
|
|
---
|
|
--- Other things in the module will not be accessible. This is the public API
|
|
--- for your extension. Consider not breaking it a lot :laugh:
|
|
---
|
|
--- TODO:
|
|
--- - actions
|
|
extensions.register = function(mod)
|
|
return mod
|
|
end
|
|
|
|
extensions.load = function(name)
|
|
local ext = load_extension(name)
|
|
if ext.setup then
|
|
ext.setup(extensions._config[name] or {}, require("telescope.config").values)
|
|
end
|
|
return extensions.manager[name]
|
|
end
|
|
|
|
extensions.set_config = function(extensions_config)
|
|
extensions._config = extensions_config or {}
|
|
end
|
|
|
|
return extensions
|