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

Add Jline option to do list view of autocomplete suggestions #582

Closed
parrotcar00 opened this issue Oct 2, 2020 · 3 comments
Closed

Add Jline option to do list view of autocomplete suggestions #582

parrotcar00 opened this issue Oct 2, 2020 · 3 comments

Comments

@parrotcar00
Copy link

parrotcar00 commented Oct 2, 2020

I just saw Python prompt toolkit: https://github.com/prompt-toolkit/python-prompt-toolkit which does a list view of autocomplete suggestions and was wondering if I could do something similar with Jline? I was looking for a Java library instead of a python one to do this.

@mattirn
Copy link
Collaborator

mattirn commented Oct 3, 2020

Yes, you can do something similar using TailTipWidgets.

There is a test implementation you can play with Console and a couple of demo apps to start from

  1. Groovy REPL
    Uses JLineCommandRegistry. You can create commands that have Object parameters and returns Object and you can use scripts within your app. Wiki pages: Groovy language REPL, REPL Console and REPL Console Customization. Updated asciinema demo.
  2. Graal
    Uses JLineCommandRegistry. No Groovy nor console scripts and variables.
  3. Picocli

If a list view of suggestions you mean a list below the field to be completed like in figure below then the answer is no.

ptpython

@mattirn
Copy link
Collaborator

mattirn commented Oct 5, 2020

Added JLine option AUTO_MENU_LIST to show suggestions below the field to be completed. Menu colours can be customised using JLine variables COMPLETION_COLOR_STARTING, COMPLETION_COLOR_DESCRIPTION and COMPLETION_LIST_BACKGROUND_COLOR

auto-menu-list

@parrotcar00
Copy link
Author

Thanks @mattirn! , this looks exactly what I was looking for.

@mattirn mattirn closed this as completed Oct 6, 2020
@mattirn mattirn changed the title Does Jline have any option to do list view of autocomplete suggestions? Add Jline option to do list view of autocomplete suggestions Oct 6, 2020
@mattirn mattirn mentioned this issue Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants