Closed dominicpalmer closed 1 year ago
Hey, thanks for the detailed bug report, i have this problem already in my list as well.
The reason why this is not implemented yet is that we have multiple ways to get the problems and not all of them behave the same.
To order them we will need some special handling when adding problems, i hope this will be performant with all problem collectors.
It is easy to implement for the HighlightProblemListener
and for the ManualScanner as they update from a complete list of new problems on each change.
The MarkupModelProblemListener
instead works with change events and updates one problem for each event, so thats not that easy to do.
I would like to implement both of your suggestions, with a toggle to switch between them.
I try to do this for the next release as it bothers me as well.
I closed the other PR because my implementation was bad.
Awesome. Thank you for this change 👍
Issue
When a line contains more than one problem, the resulting labels aren't ordered by problem severity. And moreover, the labels aren't always ordered by where on the line the problem originates, either.
For example, I'd expect these two lines to have the errors (red) displayed furthest left. Only the first line has this, despite the problems being ordered the same:
Suggestions
Possible approaches for when a line contains multiple problems of different severities:
i) Display all problems, but first order by problem severity and then by problem location on the line. This gives the user a list of 'things' to work through, prioritised by importance. ii) Only ever display problems of the highest severity for a given line. Only once the highest severity problems are resolved do the next highest severity problems get displayed. FYI this is how similar plugins for other editors work. Here's Visual Studio: