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

Provide built in mechanism for custom sorting #677

Closed
bdw429s opened this issue May 26, 2021 · 3 comments
Closed

Provide built in mechanism for custom sorting #677

bdw429s opened this issue May 26, 2021 · 3 comments

Comments

@bdw429s
Copy link
Contributor

bdw429s commented May 26, 2021

99% of the time I'm fine with the default sorting of completion candidates. I've ran into a few scenarios where I would like to sort them differently (such as a list of items sorted by most recently accessed). I see there is a workaround provided in this issue to subclass the Candidate class and override the compareTo() method. I'm interacting with JLine from a JVM language (CFML) that adds enough boilerplate and runtime overhead to extend Java classes on the fly that this is not a very convenient option for me.

I would like to suggest the Candidate class introduce a new numeric sort member that defaults to 0 when not set. That will allow the default behavior to persist, but when creating my Candidate instances, I can pass a sort integer of my own creation to force an arbitrary sort order while still relying on the base compareTo() method.

@bdw429s
Copy link
Contributor Author

bdw429s commented May 26, 2021

I have taken a crack at my suggestion in this pull and it seems to work quite nicely in my local testing

#678

@bdw429s
Copy link
Contributor Author

bdw429s commented Jul 1, 2021

@gnodet @mattirn Any input on this?

1 similar comment
@bdw429s
Copy link
Contributor Author

bdw429s commented Sep 2, 2021

@gnodet @mattirn Any input on this?

@gnodet gnodet closed this as completed Oct 14, 2021
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

No branches or pull requests

2 participants