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

Avoid duplicate quick access entry (fixes #152) #153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,14 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
QuickAccessEntry.MATCH_PERFECT)));
}
res.addAll(entriesPerProvider.values());

// if one category provides the same single entry like "previous", we can avoid
// showing the duplicate second list
if (res.size() >= 2 && res.get(0).size() == 1 && res.get(1).size() == 1
Copy link

@Wittmaxi Wittmaxi Sep 6, 2023

Choose a reason for hiding this comment

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

I there a good way to increase clarity by extracting these boolean-statements into either a method or separate variables? For example, a

boolean isDuplicateCategory = ...

would help make the code speak for itself

Copy link
Member

Choose a reason for hiding this comment

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

just wondering , what is the next action on this PR @Wittmaxi is the above suggestion a blocker ?

Copy link

Choose a reason for hiding this comment

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

@elsazac no, I was just wondering if the code-quality could be improved. I think this is fine

Copy link
Member

Choose a reason for hiding this comment

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

This can have some reviews.

&& (res.get(0).get(0).element.equals(res.get(1).get(0).element))) {
res.remove(1);
}

return (List<QuickAccessEntry>[]) res.toArray(new List<?>[res.size()]);
}

Expand Down
Loading