You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that newlines are stripped from diagnostic messages from show_line_diagnostics, which can render them distorted/unreadable in some cases.
Steps to reproduce
min.lua
vim.opt.rtp:append('~/.local/share/nvim/lazy/lspsaga.nvim')
vim.opt.rtp:append('~/.local/share/nvim/lazy/nvim-lspconfig')
local lspconfig = require('lspconfig')
-- setup rust-analyzer with default config
lspconfig.rust_analyzer.setup({})
-- don't show inline diagnostics
vim.diagnostic.enable(false)
require('lspsaga').setup({})
main.rs
fn demo(arg: String) {
println!("{arg}");
}
fn main() {
let s = "my string".to_string();
demo(s);
demo(s);
}
nvim --clean -u min.lua main.rs
Expected behavior
Here's an example from rust-analyzer where the message contents are:
use of moved value: `s`\nvalue used here after move"
vim.diagnostic.open_float()
The builtin diagnostic float handler preserves the newline, as expected.
screenshot
Lspsaga show_line_diagnostics
Lspsaga strips the newline before rendering.
screenshot (minimal)
The minimum repro example is still somewhat readable, but in my full config where the ` is hidden by the markdown render process (not sure why--different problem I guess), things get even less readable:
I'm sympathetic to the fact that the message we're receiving from rust-analyzer is not super great. The purpose of the newline in the message is kind of ambiguous, making it difficult for lspsaga to decide how to consume the message. If the newline is intended to be a line break that separates two distinct statements, it's probably "significant" and shouldn't be stripped, but if it's just text-wrapping that survives from the source material then a renderer/consumer should be able to treat it as superfluous and strip it away.
Describe the bug
Hi there 👋
I've noticed that newlines are stripped from diagnostic messages from
show_line_diagnostics
, which can render them distorted/unreadable in some cases.Steps to reproduce
min.lua
main.rs
Expected behavior
Here's an example from rust-analyzer where the message contents are:
vim.diagnostic.open_float()
The builtin diagnostic float handler preserves the newline, as expected.
screenshot
Lspsaga show_line_diagnostics
Lspsaga strips the newline before rendering.
screenshot (minimal)
The minimum repro example is still somewhat readable, but in my full config where the ` is hidden by the markdown render process (not sure why--different problem I guess), things get even less readable:
screenshot (full)
Neovim version (nvim -v)
0.10.2
lspsaga commit
d027f8b
Terminal name/version
alacritty 0.14.0
The text was updated successfully, but these errors were encountered: