chore: remove all LSP warnings

main
bhagwan 2 years ago
parent 5f5d7e2ade
commit 243ec9d9f3

@ -90,6 +90,7 @@ M.live_grep_old = require'fzf-lua.providers.grep'.live_grep_st
M.live_grep_native = require'fzf-lua.providers.grep'.live_grep_native
M.live_grep_resume = require'fzf-lua.providers.grep'.live_grep_resume
M.live_grep_glob = require'fzf-lua.providers.grep'.live_grep_glob_mt
M.live_grep_glob_old = require'fzf-lua.providers.grep'.live_grep_glob
M.grep_last = require'fzf-lua.providers.grep'.grep_last
M.grep_cword = require'fzf-lua.providers.grep'.grep_cword
M.grep_cWORD = require'fzf-lua.providers.grep'.grep_cWORD

@ -31,13 +31,13 @@ local function find_last_newline(str)
end
end
local function find_next_newline(str, start_idx)
--[[ local function find_next_newline(str, start_idx)
for i=start_idx or 1,#str do
if string_byte(str, i) == 10 then
return i
end
end
end
end ]]
local function process_kill(pid, signal)
if not pid or not tonumber(pid) then return false end
@ -82,7 +82,7 @@ M.spawn = function(opts, fn_transform, fn_done)
local error_pipe = uv.new_pipe(false)
local write_cb_count = 0
local prev_line_content = nil
local num_lines = 0
-- local num_lines = 0
if opts.fn_transform then fn_transform = opts.fn_transform end

@ -16,6 +16,7 @@ end
M._fzf_lua_server = _G._fzf_lua_server
---@diagnostic disable-next-line: undefined-field
M._devicons_path = _G._devicons_path
---@diagnostic disable-next-line: undefined-field
M._devicons_setup = _G._devicons_setup
local function load_config_section(s, datatype)

@ -118,11 +118,11 @@ function Previewer.base:display_entry(entry_str)
self.preview_bufnr = self:clear_preview_buf()
end
local populate_preview_buf = function(entry_str)
local populate_preview_buf = function(entry_str_)
if not self.win or not self.win:validate_preview() then return end
-- specialized previewer populate function
self:populate_preview_buf(entry_str)
self:populate_preview_buf(entry_str_)
-- set preview window options
if not self.preview_isterm then

@ -43,7 +43,7 @@ function Previewer.cmd:action(o)
if self.opts._line_placeholder then
filespec = "{1}"
end
local act = shell.raw_action(function (items, fzf_lines, _)
local act = shell.raw_action(function (items, _, _)
-- only preview first item
local file = path.entry_to_file(items[1], not self.relative and self.opts.cwd)
return file.path

@ -3,7 +3,6 @@ local path = require "fzf-lua.path"
local utils = require "fzf-lua.utils"
local config = require "fzf-lua.config"
local actions = require "fzf-lua.actions"
local fn, api = vim.fn, vim.api
local M = {}
@ -204,9 +203,9 @@ M.buffer_lines = function(opts)
for _, bufnr in ipairs(buffers) do
local data = {}
local filepath = api.nvim_buf_get_name(bufnr)
if api.nvim_buf_is_loaded(bufnr) then
data = api.nvim_buf_get_lines(bufnr, 0, -1, false)
local filepath = vim.api.nvim_buf_get_name(bufnr)
if vim.api.nvim_buf_is_loaded(bufnr) then
data = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
elseif vim.fn.filereadable(filepath) ~= 0 then
data = vim.fn.readfile(filepath, "")
end

@ -1,6 +1,5 @@
local core = require "fzf-lua.core"
local utils = require "fzf-lua.utils"
local shell = require "fzf-lua.shell"
local config = require "fzf-lua.config"
local M = {}

@ -298,37 +298,37 @@ M.live_grep_glob = function(opts)
utils.warn("'--glob|iglob' flags requires 'rg' (https://github.com/BurntSushi/ripgrep)")
return
end
opts.cmd_fn = function(opts, query, no_esc)
opts.cmd_fn = function(o, query, no_esc)
local glob_arg, glob_str = "", ""
local search_query = query or ""
if query:find(opts.glob_separator) then
search_query, glob_str = query:match("(.*)"..opts.glob_separator.."(.*)")
if query:find(o.glob_separator) then
search_query, glob_str = query:match("(.*)"..o.glob_separator.."(.*)")
for _, s in ipairs(utils.strsplit(glob_str, "%s")) do
glob_arg = glob_arg .. (" %s %s")
:format(opts.glob_flag, vim.fn.shellescape(s))
:format(o.glob_flag, vim.fn.shellescape(s))
end
end
-- copied over from get_grep_cmd
local search_path = ''
if opts.filespec and #opts.filespec>0 then
search_path = opts.filespec
elseif opts.filename and #opts.filename>0 then
search_path = vim.fn.shellescape(opts.filename)
if o.filespec and #o.filespec>0 then
search_path = o.filespec
elseif o.filename and #o.filename>0 then
search_path = vim.fn.shellescape(o.filename)
end
if not (no_esc or opts.no_esc) then
if not (no_esc or o.no_esc) then
search_query = utils.rg_escape(search_query)
end
-- do not escape at all
if not (no_esc == 2 or opts.no_esc == 2) then
if not (no_esc == 2 or o.no_esc == 2) then
search_query = vim.fn.shellescape(search_query)
end
local cmd = ("rg %s %s -- %s %s")
:format(opts.rg_opts, glob_arg, search_query, search_path)
:format(o.rg_opts, glob_arg, search_query, search_path)
return cmd
end
opts.__FNCREF__ = utils.__FNCREF__()

@ -24,7 +24,8 @@ end
-- instances will then use the same path as the address and it causes a mess,
-- i.e. actions stop working on the old instance. So we create our own (random
-- path) RPC server for this instance if it hasn't been started already.
local action_server_address = nil
-- NOT USED ANYMORE, we use `vim.g.fzf_lua_server` instead
-- local action_server_address = nil
function M.raw_async_action(fn, fzf_field_expression)
@ -67,9 +68,9 @@ function M.raw_action(fn, fzf_field_expression)
local receiving_function = function(pipe, ...)
local ret = fn(...)
local on_complete = function(err)
-- We are NOT asserting, in case fzf closes the pipe before we can send
-- the preview.
local on_complete = function(_)
-- We are NOT asserting, in case fzf closes
-- the pipe before we can send the preview
-- assert(not err)
uv.close(pipe)
end

@ -11,7 +11,7 @@ end
local preview_socket, preview_socket_path = get_preview_socket()
uv.listen(preview_socket, 100, function(err)
uv.listen(preview_socket, 100, function(_)
local preview_receive_socket = uv.new_pipe(false)
-- start listening
uv.accept(preview_socket, preview_receive_socket)

Loading…
Cancel
Save