From ca58bf8d64a2ac00ad7dececd95c1f7b20b23fd1 Mon Sep 17 00:00:00 2001 From: Cagdas Salur Date: Thu, 30 Mar 2023 14:13:02 +0300 Subject: [PATCH] Take optional prompt parser from user if configured --- lua/telescope-live-grep-args/prompt_parser.lua | 2 +- lua/telescope/_extensions/live_grep_args.lua | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/telescope-live-grep-args/prompt_parser.lua b/lua/telescope-live-grep-args/prompt_parser.lua index 768c032..a066fc5 100644 --- a/lua/telescope-live-grep-args/prompt_parser.lua +++ b/lua/telescope-live-grep-args/prompt_parser.lua @@ -150,7 +150,7 @@ M.parse = function(prompt, autoquote) ::afterloop:: - return parts + return {}, parts end return M diff --git a/lua/telescope/_extensions/live_grep_args.lua b/lua/telescope/_extensions/live_grep_args.lua index 273416a..9a62ec7 100644 --- a/lua/telescope/_extensions/live_grep_args.lua +++ b/lua/telescope/_extensions/live_grep_args.lua @@ -32,6 +32,7 @@ local live_grep_args = function(opts) opts.vimgrep_arguments = opts.vimgrep_arguments or conf.vimgrep_arguments opts.entry_maker = opts.entry_maker or make_entry.gen_from_vimgrep(opts) opts.cwd = opts.cwd and vim.fn.expand(opts.cwd) + opts.prompt_parser = opts.prompt_parser or prompt_parser if opts.search_dirs then for i, path in ipairs(opts.search_dirs) do @@ -45,7 +46,11 @@ local live_grep_args = function(opts) end local args = tbl_clone(opts.vimgrep_arguments) - local prompt_parts = prompt_parser.parse(prompt, opts.auto_quoting) + local extra_args, prompt_parts = opts.prompt_parser.parse(prompt, opts.auto_quoting) + + for _, arg in ipairs(extra_args) do + table.insert(args, arg) + end local cmd = vim.tbl_flatten { args, prompt_parts, opts.search_dirs } return cmd