Skip to content

Refactore report tree#107

Closed
csordasmarton wants to merge 1 commit intoEricsson:mainfrom
csordasmarton:refactore_report_tree
Closed

Refactore report tree#107
csordasmarton wants to merge 1 commit intoEricsson:mainfrom
csordasmarton:refactore_report_tree

Conversation

@csordasmarton
Copy link
Copy Markdown
Contributor

Closes #59 and closes #40

  • Refactore the report tree's code.
  • Display depth of report steps.
  • Group reports by severity levels.

Screenshot:
image

@csordasmarton csordasmarton added enhancement New feature or request refactoring labels Apr 19, 2022
@csordasmarton csordasmarton added this to the 1.4.0 milestone Apr 19, 2022
@csordasmarton csordasmarton requested a review from Discookie April 19, 2022 12:08
- Refactore the report tree's code.
- Display depth of report steps.
- Group reports by severity levels.
@csordasmarton csordasmarton force-pushed the refactore_report_tree branch from 99c892c to cb42347 Compare April 19, 2022 12:18
Copy link
Copy Markdown
Collaborator

@Discookie Discookie left a comment

Choose a reason for hiding this comment

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

Found a pretty big bug in it:
With the repr. steps shown, going to a different file and then back to the original file causes this issue:
image
(No logs other than that to add here)
From that point, the Reports in current file view is empty, and the error shows for all other files opened.
This is probably why the tests failed as well.

Other than that, the code looks fine with minor nitpicks.

ctx.subscriptions.push(this._diagnosticsUpdated = new EventEmitter());
window.onDidChangeVisibleTextEditors(this.onDocumentsChanged, this, ctx.subscriptions);
window.onDidChangeVisibleTextEditors((e: TextEditor[]) => {
setTimeout(() => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we need to put this in a setTimeout, instead of into onDocumentsChanged directly?

window.onDidChangeActiveTextEditor(this.refreshBugList, this, ctx.subscriptions);
ExtensionApi.diagnostics.diagnosticsUpdated(this.refreshBugList, this, ctx.subscriptions);
window.onDidChangeActiveTextEditor(() => {
setTimeout(() => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same question, why is setTimeout needed here?

const selectedIds = new Set(this.selectedTreeItems.map(item => item.id));
this.treeItems.forEach(root => root.traverse(item => {
if (selectedIds.has(item.id)) {
this.tree?.reveal(item, { select: true, focus: true }).then(() => {}, () => {});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is that empty .then needed here? Use the void operator instead.

// No children of sticky when there's no selected report
if (entry === undefined) {
return [];
const severityItems: { [key: string]: TreeDiagnosticReport[] } = {};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to use a Map here, the flow shouldn't be much different.

@Discookie Discookie mentioned this pull request Jul 8, 2022
@Discookie
Copy link
Copy Markdown
Collaborator

Continued in #112.

@Discookie Discookie closed this Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display depth of repr. steps Group reports by severity levels

2 participants