fix string cannot contain newlines error while showing diagnostics (#1487)

This commit is contained in:
Abouzar Parvan 2021-09-06 12:49:00 +04:30 committed by GitHub
parent 9eeb4f23da
commit 2ccae0a746
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,7 +89,8 @@ function M.show_line_diagnostics()
vim.api.nvim_win_set_option(winnr, "winblend", 0)
vim.api.nvim_buf_set_var(bufnr, "lsp_floating_window", winnr)
for i, diag in ipairs(diags) do
vim.api.nvim_buf_set_lines(bufnr, i - 1, i - 1, 0, { diag.message })
local message = diag.message:gsub("[\n\r]", " ")
vim.api.nvim_buf_set_lines(bufnr, i - 1, i - 1, 0, { message })
vim.api.nvim_buf_add_highlight(
bufnr,
-1,