From a5608b9026b67269b2ef9a34d0cbaa3e477aca0c Mon Sep 17 00:00:00 2001 From: Luke Kershaw <35707277+l-kershaw@users.noreply.github.com> Date: Sat, 3 Jul 2021 22:31:45 +0100 Subject: feat: option to `include_extensions` in `builtin` picker (#953) - add option `include_extensions` which defaults to `false` - if `include_extensions` is `true` then add functions from extensions to results - update `actions.run_builtin` to check if extension function provided --- lua/telescope/actions/init.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lua/telescope/actions/init.lua') diff --git a/lua/telescope/actions/init.lua b/lua/telescope/actions/init.lua index af4c1c8..bf45bb3 100644 --- a/lua/telescope/actions/init.lua +++ b/lua/telescope/actions/init.lua @@ -332,8 +332,17 @@ end actions.run_builtin = function(prompt_bufnr) local entry = action_state.get_selected_entry(prompt_bufnr) -actions._close(prompt_bufnr, true) - require('telescope.builtin')[entry.text]() + actions._close(prompt_bufnr, true) + if string.match(entry.text," : ") then + -- Call appropriate function from extensions + local split_string = vim.split(entry.text," : ") + local ext = split_string[1] + local func = split_string[2] + require('telescope').extensions[ext][func]() + else + -- Call appropriate telescope builtin + require('telescope.builtin')[entry.text]() + end end actions.insert_symbol = function(prompt_bufnr) -- cgit v1.2.3