From cb4e3bcaf8465eb79daa4a9db886265901a785fa Mon Sep 17 00:00:00 2001 From: andrewwillette Date: Sat, 29 Mar 2025 18:51:37 -0500 Subject: [PATCH 1/2] resolving deprecation for lsp client.get call --- lua/copilot/api.lua | 2 +- lua/copilot/client.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/copilot/api.lua b/lua/copilot/api.lua index 69951c00..639cb7e1 100644 --- a/lua/copilot/api.lua +++ b/lua/copilot/api.lua @@ -28,7 +28,7 @@ end ---@return boolean sent function mod.notify(client, method, params) logger.trace("api notify:", method, params) - return client.notify(method, params) + return client:notify(method, params) end ---@alias copilot_editor_info { name: string, version: string } diff --git a/lua/copilot/client.lua b/lua/copilot/client.lua index 87e35ef8..89aaf7bb 100644 --- a/lua/copilot/client.lua +++ b/lua/copilot/client.lua @@ -434,7 +434,7 @@ function M.add_workspace_folder(folder_path) local client = M.get() if client and client.initialized then - client.notify("workspace/didChangeWorkspaceFolders", { + client:notify("workspace/didChangeWorkspaceFolders", { event = { added = { workspace_folder }, removed = {}, From a151b273901ef40b5f3f0c6828be1b64a125fc1e Mon Sep 17 00:00:00 2001 From: Antoine Gaudreau Simard Date: Sat, 29 Mar 2025 20:31:12 -0400 Subject: [PATCH 2/2] fix: keep support for neovim 0.10 --- lua/copilot/api.lua | 7 ++++++- lua/copilot/panel.lua | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/copilot/api.lua b/lua/copilot/api.lua index e5aec747..3c27f1e7 100644 --- a/lua/copilot/api.lua +++ b/lua/copilot/api.lua @@ -28,7 +28,12 @@ end ---@return boolean sent function mod.notify(client, method, params) logger.trace("api notify:", method, params) - return client:notify(method, params) + + if vim.fn.has("nvim-0.11") == 1 then + return client:notify(method, params) + else + return client.notify(method, params) + end end ---@alias copilot_editor_info { name: string, version: string } diff --git a/lua/copilot/panel.lua b/lua/copilot/panel.lua index 085548c4..fc6f7537 100644 --- a/lua/copilot/panel.lua +++ b/lua/copilot/panel.lua @@ -469,7 +469,7 @@ function panel:refresh() else local utf16_index -- assume cursor at end of line - if vim.has("nvim-0.11") then + if vim.fn.has("nvim-0.11") == 1 then utf16_index = vim.str_utfindex(self.state.line, "utf-16") else ---@diagnostic disable-next-line: missing-parameter