folke / trouble.nvim

🚦 A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing.
Apache License 2.0
5.36k stars 175 forks source link

bug: two line error messages concatenated without space inbetween (Rust analyzer errors) #279

Closed kting28 closed 1 year ago

kting28 commented 1 year ago

Did you check docs and existing issues?

Neovim version (nvim -v)

0.9.0

Operating system/version

Ubuntu 22.0

Describe the bug

image

The actual diagnostic messages from rust analyzer contains 2 lines:

1: cannot borrow `producer` as mutable more than once at a time
second mutable borrow occurs here (rustc)

Steps To Reproduce

  1. neovim with rust analyzer set up. Create any errors that has two lines.

Expected Behavior

At least a space should be introduced when the two lines are joined together.

Repro

don't think this is needed.
Diablo-D3 commented 1 year ago

As a rust user, I, too, have this issue.

My suggested fix is that multiple lines show in each item, as that would be the most ergonomically correct interpretation.

MariaSolOs commented 1 year ago

It seems like this is by design: https://github.com/folke/trouble.nvim/blob/20d1b30d6925213abece21d35858a16e11d1e9fc/lua/trouble/util.lua#L180

MariaSolOs commented 1 year ago

Okay I tried something in #305. Gotta wait to hear back from @folke regarding if this should be behind a setting, since this changes the layout a bit. My proposal is to display the diagnostic source and code in its own line, and have each related diagnostic below it.

A preview of how this looks:

image

Note that this also affects single line diagnostics (I'm open to not changing these though):

image

What do you think? :)

kting28 commented 1 year ago

May be leave single line alone ?

MariaSolOs commented 1 year ago

@kting28 yeah I think it would be better to keep the compact format for single-line diagnostics. I'm also debating whether have the diagnostic icon for each line of multiline diagnostics (as in the picture above shows) or just have it before the diagnostic source and position...

MariaSolOs commented 1 year ago

Okay this is what it looks like with the latest commit:

image

As for folding, it might be beyond my expertise, but I'll do my best :)

MariaSolOs commented 1 year ago

I also want to wait for @folke's blessing before I continue to make sure these are changes that he approves.

MariaSolOs commented 1 year ago

After looking at it more closely, I think that keeping the icon besides the diagnostic code looks better:

image