doc: fix typecheck errors in nvim 0.11

This commit is contained in:
Steven Arcangeli 2025-03-30 21:56:41 -07:00
parent ba1f50a9a8
commit 5b38bfe279
4 changed files with 53 additions and 21 deletions

View file

@ -167,8 +167,13 @@ local function will_file_operation(method, capability_name, files, options)
}
end, matching_files),
}
---@diagnostic disable-next-line: invisible
local result, err = client.request_sync(method, params, options.timeout_ms or 1000, 0)
local result, err
if vim.fn.has("nvim-0.11") == 1 then
result, err = client:request_sync(method, params, options.timeout_ms or 1000, 0)
else
---@diagnostic disable-next-line: param-type-mismatch
result, err = client.request_sync(method, params, options.timeout_ms or 1000, 0)
end
if result and result.result then
if options.apply_edits ~= false then
vim.lsp.util.apply_workspace_edit(result.result, client.offset_encoding)
@ -204,8 +209,12 @@ local function did_file_operation(method, capability_name, files)
}
end, matching_files),
}
---@diagnostic disable-next-line: invisible
client.notify(method, params)
if vim.fn.has("nvim-0.11") == 1 then
client:notify(method, params)
else
---@diagnostic disable-next-line: param-type-mismatch
client.notify(method, params)
end
end
end
end
@ -280,9 +289,15 @@ function M.will_rename_files(files, options)
}
end, matching_files),
}
local result, err =
---@diagnostic disable-next-line: invisible
client.request_sync(ms.workspace_willRenameFiles, params, options.timeout_ms or 1000, 0)
local result, err
if vim.fn.has("nvim-0.11") == 1 then
result, err =
client:request_sync(ms.workspace_willRenameFiles, params, options.timeout_ms or 1000, 0)
else
result, err =
---@diagnostic disable-next-line: param-type-mismatch
client.request_sync(ms.workspace_willRenameFiles, params, options.timeout_ms or 1000, 0)
end
if result and result.result then
if options.apply_edits ~= false then
vim.lsp.util.apply_workspace_edit(result.result, client.offset_encoding)
@ -313,8 +328,12 @@ function M.did_rename_files(files)
}
end, matching_files),
}
---@diagnostic disable-next-line: invisible
client.notify(ms.workspace_didRenameFiles, params)
if vim.fn.has("nvim-0.11") == 1 then
client:notify(ms.workspace_didRenameFiles, params)
else
---@diagnostic disable-next-line: param-type-mismatch
client.notify(ms.workspace_didRenameFiles, params)
end
end
end
end