summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/_extensions/init.lua3
-rw-r--r--lua/telescope/builtin/internal.lua13
2 files changed, 11 insertions, 5 deletions
diff --git a/lua/telescope/_extensions/init.lua b/lua/telescope/_extensions/init.lua
index fc3fa2c..c3349ff 100644
--- a/lua/telescope/_extensions/init.lua
+++ b/lua/telescope/_extensions/init.lua
@@ -43,6 +43,9 @@ extensions.manager = setmetatable({}, {
---
--- 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:
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua
index a868bc6..7892ba4 100644
--- a/lua/telescope/builtin/internal.lua
+++ b/lua/telescope/builtin/internal.lua
@@ -55,11 +55,14 @@ internal.builtin = function(opts)
title = "Telescope Pickers"
for ext, funcs in pairs(require("telescope").extensions) do
for func_name, func_obj in pairs(funcs) do
- local debug_info = debug.getinfo(func_obj)
- table.insert(objs, {
- filename = string.sub(debug_info.source, 2),
- text = string.format("%s : %s", ext, func_name),
- })
+ -- Only include exported functions whose name doesn't begin with an underscore
+ if type(func_obj) == "function" and string.sub(func_name, 0, 1) ~= "_" then
+ local debug_info = debug.getinfo(func_obj)
+ table.insert(objs, {
+ filename = string.sub(debug_info.source, 2),
+ text = string.format("%s : %s", ext, func_name),
+ })
+ end
end
end
end