Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take optional prompt parser from user if configured #52

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/telescope-live-grep-args/prompt_parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ M.parse = function(prompt, autoquote)

::afterloop::

return parts
return {}, parts
end

return M
7 changes: 6 additions & 1 deletion lua/telescope/_extensions/live_grep_args.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down