From a6e2df0bb14ed9089d79cc59619b5723ac1e5e47 Mon Sep 17 00:00:00 2001 From: Daniel Imfeld Date: Sun, 6 Oct 2024 16:21:18 -1000 Subject: [PATCH 1/3] Fix LSP crash when opening chat --- lua/codeium/api.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/codeium/api.lua b/lua/codeium/api.lua index db0b5cd..d7eeda8 100644 --- a/lua/codeium/api.lua +++ b/lua/codeium/api.lua @@ -442,8 +442,8 @@ function Server:new() cursor_offset = 0, text = text, line_ending = line_ending, - absolute_path = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufnr), ":p"), - relative_path = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufnr), ":"), + absolute_uri = util.get_uri(vim.api.nvim_buf_get_name(bufnr)), + workspace_uri = util.get_uri(util.get_relative_path(bufnr)), } request("RefreshContextForIdeAction", { From b90a6d3d2dd7a79368c2176e3791a3399703ce02 Mon Sep 17 00:00:00 2001 From: Daniel Imfeld Date: Fri, 11 Oct 2024 07:49:18 -1000 Subject: [PATCH 2/3] Use relative_path_migrate_me_to_workspace_uri instead of workspace_uri for now --- lua/codeium/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/codeium/api.lua b/lua/codeium/api.lua index d7eeda8..8315bb6 100644 --- a/lua/codeium/api.lua +++ b/lua/codeium/api.lua @@ -443,7 +443,7 @@ function Server:new() text = text, line_ending = line_ending, absolute_uri = util.get_uri(vim.api.nvim_buf_get_name(bufnr)), - workspace_uri = util.get_uri(util.get_relative_path(bufnr)), + relative_path_migrate_me_to_workspace_uri = util.get_uri(util.get_relative_path(bufnr)), } request("RefreshContextForIdeAction", { From 88fbf8ee2d08ba63e609a9e6de80a27e6d212f2e Mon Sep 17 00:00:00 2001 From: Daniel Imfeld Date: Fri, 11 Oct 2024 07:59:39 -1000 Subject: [PATCH 3/3] Use relative_path_migrate_me_to_workspace_uri instead of workspace_uri for now --- lua/codeium/api.lua | 5 ++--- lua/codeium/util.lua | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/codeium/api.lua b/lua/codeium/api.lua index 8315bb6..b4e719f 100644 --- a/lua/codeium/api.lua +++ b/lua/codeium/api.lua @@ -443,7 +443,7 @@ function Server:new() text = text, line_ending = line_ending, absolute_uri = util.get_uri(vim.api.nvim_buf_get_name(bufnr)), - relative_path_migrate_me_to_workspace_uri = util.get_uri(util.get_relative_path(bufnr)), + relative_path_migrate_me_to_workspace_uri = util.get_relative_path(bufnr), } request("RefreshContextForIdeAction", { @@ -453,8 +453,7 @@ function Server:new() notify.error("failed refresh context: " .. err.out) return end - end - ) + end) end function m.add_workspace() diff --git a/lua/codeium/util.lua b/lua/codeium/util.lua index 2fc6db2..fc7969e 100644 --- a/lua/codeium/util.lua +++ b/lua/codeium/util.lua @@ -36,7 +36,7 @@ function M.get_newline(bufnr) end function M.get_relative_path(bufnr) - return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufnr), ":") + return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufnr), ":.") end function M.get_uri(path)