-
Notifications
You must be signed in to change notification settings - Fork 11
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
is there a way to do autocomplete with suggestions? #15
Comments
Nope, but if you have an autocompletion engine in mind, I don't think that would be too difficult to integrate. All that would be required is to have some module provide a function that takes the content of a line and returns a list of autocompletions. fn autocomplete(line: &str, autocompletions: &mut Vec<String>, requested: u32) {
// Take line and write the requested number of completions with requested number
} Once you have that, a naive display of potential autocompletes could be done, or possibly something more complicated where the user can scroll through them. Actually creating an autocompletion engine though is probably a bit beyond the scope of this project, although I'm curious what the rustyline crate does 🤔. I'm not actively using this library anymore so I probably won't implement new features myself, but I'll definitely review and merge PRs! |
Would be really awesome to have the ability to register async completion handlers, e.g. to perform a web request that fetches completion candidates. This is the feature I have been missing in the other readline crates. |
That does sound pretty awesome ngl! I'm not coding for this project atm, but I will review and merge pretty much anything so long as it isn't really badly designed :). From my first guess, this doesn't seem like it'd be too big of a change (the crate already uses async for everything). You'd just have to implement the completion TUI and then allow users to handle completion requests from the readline and satisfy completion requests. If I was implementing it, it might go something like: Edit line.rs character event (or if you want completion on tab use the relevant crossterm event) to generate a new If you manage to do that though, then you could handle that event directly in the main event loop (i.e. where you handle all the other ReadlineEvents) and provide a helper function on |
is this supported by this library?
The text was updated successfully, but these errors were encountered: