Skip to content

Commit 7fe0ca6

Browse files
committed
fix(lsp): deprecated warnings
1 parent 85bedb7 commit 7fe0ca6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lua/trouble/sources/lsp.lua

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ local Util = require("trouble.util")
1212
local function get_line_col(line, index, encoding)
1313
local function get()
1414
if vim.str_byteindex then
15-
-- FIXME: uses old-style func signature, since there's no way to
16-
-- properly detect if new style is available
15+
if vim.fn.has("nvim-0.11") == 0 then
16+
return vim.str_byteindex(line, encoding, index, false)
17+
end
1718
return vim.str_byteindex(line, index, encoding == "utf-16")
1819
end
1920
return vim.lsp.util._str_byteindex_enc(line, index, encoding)
@@ -144,7 +145,12 @@ function M.request(method, params, opts)
144145
return Promise.all(vim.tbl_map(function(client)
145146
return Promise.new(function(resolve)
146147
local p = type(params) == "function" and params(client) or params --[[@as table]]
147-
client.request(method, p, function(err, result)
148+
local request = vim.fn.has("nvim-0.11") == 0
149+
and function(_, ...)
150+
return client.request(...)
151+
end
152+
or client.request
153+
request(client, method, p, function(err, result)
148154
resolve({ client = client, result = result, err = err, params = p })
149155
end, buf)
150156
end)

0 commit comments

Comments
 (0)