refactor: Remove utils.request shim

* This is no longer needed as people have probably moved on from 0.5
This commit is contained in:
Simrat Grewal
2022-08-10 16:58:24 -07:00
parent d7542aab11
commit 197a9aa45f
5 changed files with 4 additions and 40 deletions

View File

@@ -1,37 +1,5 @@
local vim = vim
local M = {}
-- callback args changed in Neovim 0.5.1/0.6. See:
-- https://github.com/neovim/neovim/pull/15504
local function mk_handler(fn)
return function(...)
local config_or_client_id = select(4, ...)
local is_new = type(config_or_client_id) ~= 'number'
if is_new then
fn(...)
else
local err = select(1, ...)
local method = select(2, ...)
local result = select(3, ...)
local client_id = select(4, ...)
local bufnr = select(5, ...)
local config = select(6, ...)
fn(
err,
result,
{ method = method, client_id = client_id, bufnr = bufnr },
config
)
end
end
end
-- from mfussenegger/nvim-lsp-compl@29a81f3
function M.request(bufnr, method, params, handler)
return vim.lsp.buf_request(bufnr, method, params, mk_handler(handler))
end
function M.is_buf_attached_to_lsp(bufnr)
local clients = vim.lsp.buf_get_clients(bufnr or 0)
return clients ~= nil and #clients > 0