fix: hopefully this fixes lsp

This commit is contained in:
2025-02-01 00:54:26 +01:00
parent e032be0118
commit aa12bca3ab

View File

@@ -86,12 +86,12 @@ local function send_did_open(bufnr, client_id, path, filetype)
return nil return nil
end 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) local client = lsp.get_client_by_id(client_id)
if not client then return end if not client then return end
local text = table.concat(api.nvim_buf_get_lines(bufnr, 0, -1, false), "\n") 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 local version = 1
client.rpc.notify("textDocument/didChange", { client.rpc.notify("textDocument/didChange", {
@@ -162,8 +162,8 @@ function M.lsp_check_file_content(path, new_content, timeout_ms)
return "(LSP) " .. err2 return "(LSP) " .. err2
end end
-- Optionally do a didChange -- Optionally do a didChange with consistent URI
send_did_change(bufnr, client_id) send_did_change(bufnr, client_id, path)
local diags = wait_for_diagnostics(bufnr, timeout_ms or 2000) local diags = wait_for_diagnostics(bufnr, timeout_ms or 2000)
local diag_str = diagnostics_to_string(diags) local diag_str = diagnostics_to_string(diags)