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

fix(gui): The result in usage search should sort by name #1363

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

cyqw
Copy link
Contributor

@cyqw cyqw commented Feb 5, 2022

The result in usage search is sort by CodeNode::COMPARATOR, it's not suitable for human reading.

@skylot
Copy link
Owner

skylot commented Feb 5, 2022

@cyqw I see what kind of issues you are trying to fix, but it is better just to fix that comparator. And only name is not enough here because, for example, variable usage needs to be sorted by usage place not name (check #1104).
So, I suggest fixing CodeNode comparator to sort by long name which used in first column renderer (here) to:

	private static final Comparator<CodeNode> COMPARATOR = Comparator
			.comparing(CodeNode::makeLongString)
			.thenComparingInt(CodeNode::getPos);

Please try to apply this change and check if it fixed your issue. If still not, share a screenshot of case which you want to improve.

Copy link
Owner

@skylot skylot left a comment

Choose a reason for hiding this comment

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

Check my comment on this PR

@cyqw
Copy link
Contributor Author

cyqw commented Feb 7, 2022

Fixed CodeNode comparater.

@skylot skylot merged commit 4bed9dc into skylot:master Feb 7, 2022
@skylot
Copy link
Owner

skylot commented Feb 7, 2022

@cyqw thanks!

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

Successfully merging this pull request may close these issues.

2 participants