Skip to content

Commit 3cd5086

Browse files
committed
refactor!: remove nvim 0.10 support as warned
1 parent f12709a commit 3cd5086

File tree

6 files changed

+8
-33
lines changed

6 files changed

+8
-33
lines changed

lua/copilot/api/init.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ function M.request(client, method, params, callback)
2020
params.bufnr = nil
2121

2222
if callback then
23-
return utils.wrap(client):request(method, params, callback, bufnr)
23+
return client:request(method, params, callback, bufnr)
2424
end
2525

2626
local co = coroutine.running()
27-
utils.wrap(client):request(method, params, function(err, data, ctx)
27+
client:request(method, params, function(err, data, ctx)
2828
coroutine.resume(co, err, data, ctx)
2929
end, bufnr)
3030
return coroutine.yield()
@@ -33,7 +33,7 @@ end
3333
---@return boolean sent
3434
function M.notify(client, method, params)
3535
logger.trace("api notify:", method, params)
36-
return utils.wrap(client):notify(method, params)
36+
return client:notify(method, params)
3737
end
3838

3939
---@alias copilot_editor_info { name: string, version: string }

lua/copilot/client/utils.lua

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,4 @@ function M.show_document(_, result)
8080
}
8181
end
8282

83-
M.wrap = vim.fn.has("nvim-0.11") == 1 and function(client)
84-
return client
85-
end or function(client)
86-
-- stylua: ignore
87-
return setmetatable({
88-
notify = function(_, ...) return client.notify(...) end,
89-
request = function(_, ...) return client.request(...) end,
90-
cancel_request = function(_, ...) return client.cancel_request(...) end,
91-
}, { __index = client })
92-
end
93-
9483
return M

lua/copilot/config/init.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ function M.merge_with_user_configs(user_configs)
5050
M[k] = v
5151
end
5252

53-
if vim.fn.has("nvim-0.11") == 1 then
54-
M.validate(M)
55-
end
56-
53+
M.validate(M)
5754
initialized = true
5855
end
5956

lua/copilot/init.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ local config = require("copilot.config")
66

77
M.setup = function(opts)
88
if vim.fn.has("nvim-0.11") == 0 then
9-
vim.notify_once(
10-
"[copilot.lua] Neovim 0.11+ will soon be required. "
11-
.. "Please upgrade your Neovim version if you wish to keep using this plugin.",
12-
vim.log.levels.WARN
13-
)
9+
logger.error("Neovim 0.11+ is required")
1410
return
1511
end
1612

lua/copilot/panel/init.lua

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -435,15 +435,8 @@ function panel:refresh()
435435
if not auto_refreshing and self.state.was_insert then
436436
vim.cmd("stopinsert")
437437
else
438-
local utf16_index
438+
local utf16_index = vim.str_utfindex(self.state.line, "utf-16")
439439
-- assume cursor at end of line
440-
if vim.fn.has("nvim-0.11") == 1 then
441-
utf16_index = vim.str_utfindex(self.state.line, "utf-16")
442-
else
443-
---@diagnostic disable-next-line: missing-parameter
444-
local _, this_utf16_index = vim.str_utfindex(self.state.line)
445-
utf16_index = this_utf16_index
446-
end
447440
params.doc.position.character = utf16_index
448441
params.position.character = params.doc.position.character
449442
end

lua/copilot/suggestion/init.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,12 @@ local function cancel_inflight_requests(ctx)
233233

234234
with_client(function(client)
235235
if ctx.first then
236-
utils.wrap(client):cancel_request(ctx.first)
236+
client:cancel_request(ctx.first)
237237
ctx.first = nil
238238
logger.trace("suggestion cancel first request")
239239
end
240240
if ctx.cycling then
241-
utils.wrap(client):cancel_request(ctx.cycling)
241+
client:cancel_request(ctx.cycling)
242242
ctx.cycling = nil
243243
logger.trace("suggestion cancel cycling request")
244244
end

0 commit comments

Comments
 (0)