mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
[breaking change] make it work for nvim 0.5.1
In nvim 0.5.1, the lsp handler signature has changed, see https://github.com/neovim/neovim/pull/15504 and LunarVim/LunarVim#1484.
This commit is contained in:
parent
002ebf2f71
commit
ffe588870d
@ -22,7 +22,7 @@ add it to your own Nvim config.
|
|||||||
See [doc here](docs/README.md) on how to install Nvim's dependencies, Nvim
|
See [doc here](docs/README.md) on how to install Nvim's dependencies, Nvim
|
||||||
itself, and how to set up on different platforms (Linux, macOS and Windows).
|
itself, and how to set up on different platforms (Linux, macOS and Windows).
|
||||||
|
|
||||||
**This config is tested against Nvim 0.5.0 release. No backward compatibility
|
**This config is tested against Nvim 0.5.1 release. No backward compatibility
|
||||||
is guaranteed.**
|
is guaranteed.**
|
||||||
|
|
||||||
# Features #
|
# Features #
|
||||||
|
|||||||
@ -166,10 +166,14 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagn
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Refs: https://github.com/neovim/nvim-lspconfig/wiki/UI-customization#show-source-in-diagnostics
|
-- Refs: https://github.com/neovim/nvim-lspconfig/wiki/UI-customization#show-source-in-diagnostics
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = function(_, _, params, client_id, _)
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = function(_, result, context, _)
|
||||||
local uri = params.uri
|
-- result contains diagnostics and uri
|
||||||
local bufnr = vim.uri_to_bufnr(uri)
|
-- context contains client_id and method, but not always buf_nr
|
||||||
|
local client_id = context.client_id
|
||||||
|
local diagnostics = result.diagnostics
|
||||||
|
local uri = result.uri
|
||||||
|
|
||||||
|
local bufnr = vim.uri_to_bufnr(uri)
|
||||||
if not bufnr then
|
if not bufnr then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -178,7 +182,7 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = function(_, _, params, cli
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local diagnostics = params.diagnostics
|
-- change diagnostics format
|
||||||
for i, v in ipairs(diagnostics) do
|
for i, v in ipairs(diagnostics) do
|
||||||
diagnostics[i].message = string.format("%s: %s", v.source, v.message)
|
diagnostics[i].message = string.format("%s: %s", v.source, v.message)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user