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

Better support for autocompletion #180

Closed
sushi-shi opened this issue Jun 26, 2022 · 2 comments · Fixed by #526
Closed

Better support for autocompletion #180

sushi-shi opened this issue Jun 26, 2022 · 2 comments · Fixed by #526
Labels
enhancement New feature or request

Comments

@sushi-shi
Copy link
Contributor

sushi-shi commented Jun 26, 2022

Currently auto-completion is very simple, it expects the first word to be a command and next words to be files. This is already wrong, as some commands are made of multiple words (sort reverse) and what's more some commands do not accept files as parameters to begin with, so we do not need auto-completion for them. And other commands accept only folders, so autocompleting files should be avoided.

I propose to either add a simple specification, which every command should implement, to aid with autocompletion.
Something akin to:

struct Command {
    spec: Specifiaction
    ...
}

struct Specification {
    params: Vec<(&'static str, Specification)>, // to cover `sort reverse`, `cd ..` and `cd -`.
    file_ty: Option<(FileTy, usize)>, // usize to show how many files the command might accept
}

enum FileTy {
    Any,
    Directories,
    FIles, 
}

This specification is in no way complete, but it covers the most general cases, which I think should suffice for now.
Or make Command implement autocompleting interface through traits. (Possibly with a default implementation).

After we decide what to do (and whether to do anything at all), I will be willing to implement it.

@sushi-shi
Copy link
Contributor Author

Also open_with requires current programs in PATH for auto-completion

@kamiyaa kamiyaa added the enhancement New feature or request label Jun 27, 2022
@kamiyaa
Copy link
Owner

kamiyaa commented Jun 27, 2022

I agree that autocompletion needs much more work. 👍

I'm kind of busy at the moment, but I'm definitely open to discussing how we want to go about designing and implementing this. :)

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

Successfully merging a pull request may close this issue.

2 participants