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.11k stars 173 forks source link

Minor format tweak and off-by-one fix #472

Closed AThePeanut4 closed 2 weeks ago

AThePeanut4 commented 1 month ago

Firstly, thank you for developing this plugin, and for all the work you've obviously put in to the rewrite. v3 is great :heart:

This PR just makes a minor tweak and fixes an off-by-one error.

The off-by-one is for the [row, col] display. ctx.item.pos seems to be (1, 0) indexed, so the +1 should be on the column, not the row.

The tweak is for the formatting of an item's "source". Currently there are three different ways this is displayed:

What I've done is change the LSP format strings to be more like the diagnostics one. This is what looks the nicest imo, but I don't really have a strong opinion here so if you feel differently then I don't mind changing it.

I've also changed the diagnostic formatting, so that the brackets around the code are also highlighted as a comment. Currently the brackets are shown as normal text, which looks a bit off to me, but again it's not a big deal and I wouldn't mind changing/reverting it.

These changes seem to work for me, but the code is quite complicated and I don't really understand much of what's going on - so it's very possible I've done something very wrong or missed something. Please feel free to fix/change anything if needed.

folke commented 1 month ago

I've just taken that pos fix from your PR and changed that already. Still need to look into the format changes (later). Thank you