From eefc148313917b1a474ba7bdf44d6d088524074a Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 3 Jan 2022 11:07:34 +0100 Subject: refactor(bootstrap): more robust git module (#2127) --- lua/lvim/lsp/peek.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'lua/lvim/lsp/peek.lua') diff --git a/lua/lvim/lsp/peek.lua b/lua/lvim/lsp/peek.lua index 08345aff..f006f934 100644 --- a/lua/lvim/lsp/peek.lua +++ b/lua/lvim/lsp/peek.lua @@ -47,9 +47,8 @@ local function create_floating_file(location, opts) -- Set some autocmds to close the window vim.api.nvim_command( - "autocmd QuitPre ++nested ++once lua pcall(vim.api.nvim_win_close, " .. winnr .. ", true)" + string.format("autocmd %s ++once lua pcall(vim.api.nvim_win_close, %d, true)", unpack(close_events), winnr) ) - vim.lsp.util.close_preview_autocmd(close_events, winnr) return bufnr, winnr end @@ -73,10 +72,6 @@ local function preview_location_callback(result) end end -local function preview_location_callback_old_signature(_, _, result) - return preview_location_callback(result) -end - local function preview_location_callback_new_signature(_, result) return preview_location_callback(result) end @@ -136,10 +131,7 @@ function M.Peek(what) else -- Make a new request and then create the new window in the callback local params = vim.lsp.util.make_position_params() - local preview_callback = preview_location_callback_old_signature - if vim.fn.has "nvim-0.5.1" > 0 then - preview_callback = preview_location_callback_new_signature - end + local preview_callback = preview_location_callback_new_signature local success, _ = pcall(vim.lsp.buf_request, 0, "textDocument/" .. what, params, preview_callback) if not success then print( -- cgit v1.2.3