Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

markers: apply problem marker sorting based on severity, line, and column number #7313

Merged
merged 1 commit into from
Mar 18, 2020

Conversation

vince-fugnitto
Copy link
Member

What it does

Fixes #6572

The following commit updates the markers to be sorted based on the following rules:

  1. markers for a given resource are first sorted by severity
  2. if the severity are equal, sort by lowest line number
  3. if the severity and line number are equal, sort by lowest column number
  4. if all props are equal, do not perform a sort

How to test

  1. perform changes that will result in diagnostics
  2. verify that the rules hold true:
Screen Shot 2020-03-10 at 9 02 24 PM

Review checklist

Reminder for reviewers

Signed-off-by: Vincent Fugnitto vincent.fugnitto@ericsson.com

@vince-fugnitto vince-fugnitto added the markers issues related to problem markers label Mar 11, 2020
@vince-fugnitto vince-fugnitto self-assigned this Mar 11, 2020
@elaihau
Copy link
Contributor

elaihau commented Mar 11, 2020

do we do any sortings based on the file paths?

in the github issue you mentioned

markers should be sorted by resource
for a given resource, markers should be sorted by severity, line and column number

so can i assume that the path-based sorting should also be supported with your change?

@vince-fugnitto
Copy link
Member Author

do we do any sortings based on the file paths?

I don't do any sorting at the moment for MarkerInfoNode (file nodes) based on their URI.
In order to align, I'll update the code to also handle the sorting of file nodes.

@vince-fugnitto
Copy link
Member Author

@elaihau there does not seem to be any sorting of files at the moment for the problems view, and it looks like we add new problems to the bottom of the view as the files are opened (with markers). This pull-request was intended to fix the issue of for a given resource, to sort it's diagnostics with a ruleset. Can we include the improvement of actual resource sorting as a different pull-request as it was not the intention of this pull-request?

Copy link
Contributor

@elaihau elaihau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested in gitpod.

Worked properly given that sorting by file paths is not in the scope of this pull request.

Thank you Vincent !

@elaihau
Copy link
Contributor

elaihau commented Mar 12, 2020

I just noticed that this pr has "fixes 6572" in its description, maybe we could create a new GH issue to keep track of the file path sorting issue.

import { Marker } from '../../common/marker';
import { Diagnostic } from '@theia/languages/lib/browser';

export namespace ProblemUtils {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) I would better to add them as static method to ProblemTree. Utils always feels like it is useful to share but I don't know what is a good concept for it.

@akosyakov
Copy link
Member

akosyakov commented Mar 12, 2020

Did you test it on performance?

cc @marcdumais-work do you remember how we used to test #2316 against java? I remember we managed to create like over 40000 problem markers, too bad that we did not have a rule to write down test by then.

Fixes #6572

The following commit updates the `markers` to be sorted based on the following rules:
- markers are sorted by `severity`.
- if the first step is equal, markers are sorted by `line number`.
- if the second step is equal, markers are sorted by `column number`.
- else return no change.

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
@vince-fugnitto
Copy link
Member Author

Did you test it on performance?

I could not find any noticeable degredation. I updated one of our eslint rules (single-quote to double-quote) and ran a task with problem-matchers. I generated 3k markers (noticeably a lot less than the mentioned 40k) and did not notice the sorting taking too long.

I will try to do more performance testing with numbers if helpful.

@akosyakov
Copy link
Member

akosyakov commented Mar 12, 2020

@vince-fugnitto it is probably fine, 3k is not enough though, i think we used to open eclipse java ls project. Initially it should report tons of error markers for different resources.

@vince-fugnitto
Copy link
Member Author

@vince-fugnitto it is probably fine, 3k is not enough though, i think we used to open eclipse java ls project. Initially it should report tons of error markers for different resources.

I verified using the eclipse.jdt.ls project (which generates ~30k markers).
With 3 runs (master and this pull-request) I got the following results:

Trial master sorting
1 11.13 11.93
2 10.90 11.05
3 11.23 11.63
Avg (sec) 11.09 11.54

I timed the time it takes once reset workbench layout is called until the time 30k markers were identified.

@lmcbout
Copy link
Contributor

lmcbout commented Mar 16, 2020

Questions
1- Should we consider sorting the files in the problem view, According to the picture below, the files are not sorted. What about if we have a multi-root, could we sort the files starting with :
root -> filename -> severity ->line number !

2- What is the big number just before the (line,colums) It does not seems to give the end-user any information, I don't see the signification of that number,

If I just look at sorting inside a file Severity -line number, it seems to work fine
SortingProblems

@vince-fugnitto
Copy link
Member Author

vince-fugnitto commented Mar 16, 2020

@lmcbout

Questions
1- Should we consider sorting the files in the problem view, According to the picture below, the files are not sorted. What about if we have a multi-root, could we sort the files starting with :
root -> filename -> severity ->line number !

Please see past discussions:

2- What is the big number just before the (line,colums) It does not seems to give the end-user any information, I don't see the signification of that number,

It is the code.
For example: '536870973' is for 'value of local variable is not used'.

@lmcbout
Copy link
Contributor

lmcbout commented Mar 16, 2020

Please see past discussions:

From @elaihau commnet:

I just noticed that this pr has "fixes 6572" in its description, maybe we could create a new GH issue to keep track of the file path sorting issue.

I agree that we should have a new issue raised and have a link in this PR or in "6572"

For question #2
It is the code.
For example: '536870973' is for 'value of local variable is not used'.

Unless a user can determine what the number means, either we provide a link or when hover the number, it points to its description, I don't see the purpose to display that big number, it just clutter the display unless we can refer to it by some means

@marcdumais-work
Copy link
Contributor

Unless a user can determine what the number means, either we provide a link or when hover the number, it points to its description, I don't see the purpose to display that big number, it just clutter the display unless we can refer to it by some means

There is not necessarily more info in the output that was parsed to generate the Marker. Anyway the error codes should be familiar to developers for a given language - generally compilers will output the same, without any more context

e.g. error 2515 generated by tsc:

image

packages/terminal/src/node/terminal-server.ts:27:14 - error TS2515: Non-abstract class 'TerminalServer' does not implement inherited abstract member 'create' from class 'BaseTerminalServer'.

@vince-fugnitto
Copy link
Member Author

vince-fugnitto commented Mar 16, 2020

@lmcbout

Please see past discussions:

From @elaihau commnet:

I just noticed that this pr has "fixes 6572" in its description, maybe we could create a new GH issue to keep track of the file path sorting issue.

As mentioned, it is already tracked: #7318

I agree that we should have a new issue raised and have a link in this PR or in "6572"

For question #2
It is the code.
For example: '536870973' is for 'value of local variable is not used'.

Unless a user can determine what the number means, either we provide a link or when hover the number, it points to its description, I don't see the purpose to display that big number, it just clutter the display unless we can refer to it by some means

It displays the code and it is consistent with vscode.

A user can perform a search based on the code, but providing links would be difficult since where would we point to exactly? In any case, this is noise in the pull-request as the code was introduced a long time ago (#3141).

Copy link
Contributor

@lmcbout lmcbout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine

Copy link
Contributor

@lmcbout lmcbout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@vince-fugnitto
Copy link
Member Author

I'll merge tomorrow if there are no objections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
markers issues related to problem markers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

problems: update problem marker sorting (severity, line, column number)
5 participants