mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
fix(lsp): improve error completion message #33812
problem: Error notifications from LSP responses were difficult to read due to
inconsistent formatting and missing critical information like client name and error codes.
solution: Implemented a more structured error notification format using pipe separators to
clearly display client name, error code (when available), and error message.
(cherry picked from commit 5c15df449a
)
This commit is contained in:
committed by
github-actions[bot]
parent
47686a1454
commit
e512c9589e
@ -506,14 +506,19 @@ local function trigger(bufnr, clients, ctx)
|
|||||||
local matches = {}
|
local matches = {}
|
||||||
local server_start_boundary --- @type integer?
|
local server_start_boundary --- @type integer?
|
||||||
for client_id, response in pairs(responses) do
|
for client_id, response in pairs(responses) do
|
||||||
|
local client = lsp.get_client_by_id(client_id)
|
||||||
if response.err then
|
if response.err then
|
||||||
vim.notify_once(response.err.message, vim.log.levels.WARN)
|
local msg = ('%s: %s %s'):format(
|
||||||
|
client and client.name or 'UNKNOWN',
|
||||||
|
response.err.code or 'NO_CODE',
|
||||||
|
response.err.message
|
||||||
|
)
|
||||||
|
vim.notify_once(msg, vim.log.levels.WARN)
|
||||||
end
|
end
|
||||||
|
|
||||||
local result = response.result
|
local result = response.result
|
||||||
if result then
|
if result then
|
||||||
Context.isIncomplete = Context.isIncomplete or result.isIncomplete
|
Context.isIncomplete = Context.isIncomplete or result.isIncomplete
|
||||||
local client = lsp.get_client_by_id(client_id)
|
|
||||||
local encoding = client and client.offset_encoding or 'utf-16'
|
local encoding = client and client.offset_encoding or 'utf-16'
|
||||||
local client_matches
|
local client_matches
|
||||||
client_matches, server_start_boundary = M._convert_results(
|
client_matches, server_start_boundary = M._convert_results(
|
||||||
|
Reference in New Issue
Block a user