From b737573667d1212ff4c76ed2a999c84c966da83d Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 20 Jun 2023 21:30:09 +0800 Subject: [PATCH] fix(flygrep): fix lsp warnings --- lua/spacevim/plugin/flygrep.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/spacevim/plugin/flygrep.lua b/lua/spacevim/plugin/flygrep.lua index b976df5ce..11b693f11 100644 --- a/lua/spacevim/plugin/flygrep.lua +++ b/lua/spacevim/plugin/flygrep.lua @@ -64,6 +64,7 @@ local grep_history = {} local preview_win_id = -1 local filter_file = '' +--- @return table # a list of searching pattern history local function read_histroy() if vim.fn.filereadable(vim.fn.expand(vim.g.spacevim_data_dir .. 'SpaceVim/flygrep_history')) @@ -75,8 +76,8 @@ local function read_histroy() '' ) ) - if vim.fn.type(_his) == 3 then - return _his + if type(_his) == table then + return _his or {} else return {} end @@ -111,6 +112,8 @@ local function append(t1, t2) end end +--- @param expr string # searching pattern +--- @return table # searching command local function get_search_cmd(expr) local cmd = { grep_exe } append(cmd, grep_opt)