From 474af4d6e2f0ebfbb5df85ca7827b67949717bae Mon Sep 17 00:00:00 2001 From: bhagwan Date: Wed, 29 Nov 2023 19:45:34 -0800 Subject: [PATCH] fix: live query prompt starting with asterisk (closes #940) --- lua/fzf-lua/providers/grep.lua | 3 ++- lua/fzf-lua/providers/lsp.lua | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/fzf-lua/providers/grep.lua b/lua/fzf-lua/providers/grep.lua index c48a8a57..d161be1b 100644 --- a/lua/fzf-lua/providers/grep.lua +++ b/lua/fzf-lua/providers/grep.lua @@ -138,7 +138,8 @@ local function normalize_live_grep_opts(opts) -- opts.__module__ = opts.__module__ or "grep" -- prepend prompt with "*" to indicate "live" query - opts.prompt = opts.prompt and opts.prompt:match("^%*") or "*" .. opts.prompt + opts.prompt = type(opts.prompt) == "string" and opts.prompt or "" + opts.prompt = opts.prompt:match("^%*") and opts.prompt or ("*" .. opts.prompt) -- when using live_grep there is no "query", the prompt input -- is a regex expression and should be saved as last "search" diff --git a/lua/fzf-lua/providers/lsp.lua b/lua/fzf-lua/providers/lsp.lua index a8441449..0eeb8865 100644 --- a/lua/fzf-lua/providers/lsp.lua +++ b/lua/fzf-lua/providers/lsp.lua @@ -719,7 +719,8 @@ M.live_workspace_symbols = function(opts) opts.__ACT_TO = opts.__ACT_TO or M.workspace_symbols -- prepend prompt with "*" to indicate "live" query - opts.prompt = opts.prompt and opts.prompt:match("^%*") or "*" .. opts.prompt + opts.prompt = type(opts.prompt) == "string" and opts.prompt or "" + opts.prompt = opts.prompt:match("^%*") and opts.prompt or ("*" .. opts.prompt) -- when using live_workspace_symbols there is no "query" -- the prompt input is the LSP query, store as "lsp_query"