IntelliJ-Inspection-Lens icon indicating copy to clipboard operation
IntelliJ-Inspection-Lens copied to clipboard

Adding `...` when error is too long

Open synopss opened this issue 2 years ago • 5 comments

When the error is too long, we should cut the error message adding ... to avoid the scrollbar becoming so large. If we need more info, it's easer / faster to check the hint on hover.

image

What about lines with multiple errors ?

synopss avatar Jun 01 '23 22:06 synopss

Hmm I don't know how common such long errors are, I don't run into them often enough to warrant dealing with the complexities of cutting text.

chylex avatar Jun 01 '23 23:06 chylex

Combined with the GitToolBox plugin, it can happen more often, but yeah, I guess it can be nice issue.

Edit : here a small example that might be help in that regard :

VSCode : image Intellij : image

I guess it's ranked by error gravity and only the top one is shown. I believe it's actually better for lisibility. What do you think ?

synopss avatar Jun 03 '23 13:06 synopss

There are two problems with only showing one inspection.

  • It requires keeping track of which errors are on which lines, and dealing with changes in edited text that join/break lines, which adds complexity.
  • Seeing all inspections requires using a mouse, which somewhat defeats the purpose of the plugin, especially for anyone who has a large enough monitor for the inspections to fit.

It also wouldn't help with singular long errors.

I'd prefer if IntelliJ had some way of globally configuring maximum width or number of inlays, so everyone could configure it however they wanted for all plugins.

chylex avatar Mar 17 '24 01:03 chylex

I understand your arguments. Just wanted to add this repo as an example on how this is handled by other plugins (here for nvim) : https://github.com/folke/trouble.nvim

n this plugin, when there are multiple errors, only the "strongest" one is prominently displayed. You can identify the presence of multiple errors by the small circle at the beginning of the line; there's one circle for each error. So if you have multiple errors, you'll have as many circles as errors (colors being the same as the error gravity). This approach is quite convenient, in my opinion.

Their philosophy essentially boils down to: "Prioritize fixing the most important issue first, so there's no need to clutter the interface with lesser ones."

Anyways, I understand why you wouldn't want to go that way, I just wanted to add some new perspective.

synopss avatar Mar 28 '24 09:03 synopss

I've also just run into this, was wondering why me editor was suddenly super laggy after a test assertion over a JavaScript bundle failed and was inlined.

It also wouldn't help with singular long errors.

This was a single incredible long error.

Seeing all inspections requires using a mouse, which somewhat defeats the purpose of the plugin, especially for anyone who has a large enough monitor for the inspections to fit.

You can just choose a large number that's big enough for pretty much any screen? We don't live in a perfect world, so compromises need to be made sometimes.

ForsakenHarmony avatar May 13 '24 20:05 ForsakenHarmony