From aa12bca3abc868b4ebacbd22b6fde83deb656869 Mon Sep 17 00:00:00 2001 From: Dominik Polakovics Date: Sat, 1 Feb 2025 00:54:26 +0100 Subject: [PATCH] fix: hopefully this fixes lsp --- lua/chatgpt_nvim/tools/lsp_robust_diagnostics.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/chatgpt_nvim/tools/lsp_robust_diagnostics.lua b/lua/chatgpt_nvim/tools/lsp_robust_diagnostics.lua index 1c6e77c..cdc15e7 100644 --- a/lua/chatgpt_nvim/tools/lsp_robust_diagnostics.lua +++ b/lua/chatgpt_nvim/tools/lsp_robust_diagnostics.lua @@ -86,12 +86,12 @@ local function send_did_open(bufnr, client_id, path, filetype) return nil end -local function send_did_change(bufnr, client_id) +local function send_did_change(bufnr, client_id, path) local client = lsp.get_client_by_id(client_id) if not client then return end local text = table.concat(api.nvim_buf_get_lines(bufnr, 0, -1, false), "\n") - local uri = vim.uri_from_bufnr(bufnr) + local uri = vim.uri_from_fname(path) local version = 1 client.rpc.notify("textDocument/didChange", { @@ -162,8 +162,8 @@ function M.lsp_check_file_content(path, new_content, timeout_ms) return "(LSP) " .. err2 end - -- Optionally do a didChange - send_did_change(bufnr, client_id) + -- Optionally do a didChange with consistent URI + send_did_change(bufnr, client_id, path) local diags = wait_for_diagnostics(bufnr, timeout_ms or 2000) local diag_str = diagnostics_to_string(diags)