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

CompletionProposal with complete #512

Closed
fonimus opened this issue Aug 20, 2022 · 4 comments
Closed

CompletionProposal with complete #512

fonimus opened this issue Aug 20, 2022 · 4 comments
Labels
branch/2.1.x Issue for a branch branch/3.0.x Issue for a branch branch/3.1.x Issue for a branch for/backport For backporting type/enhancement Is an enhancement request
Milestone

Comments

@fonimus
Copy link

fonimus commented Aug 20, 2022

Hello, I am providing in my application an ExtendedFileValueProvider which does not stop if comes a directory (i.e. the completion proposal is not complete). Today I had to extended some classes to do this, and I am wondering if it could be included in spring shell.

The aim is to add complete boolean field in CompletionProposal in order to be able to get this value in CompleterAutoConfiguration.CompleterAdapter#complete :

proposals.stream()
				.map(p -> new Candidate(
					p.dontQuote() ? p.value() : cpl.emit(p.value()).toString(),
					p.displayText(),
					p.category(),
					p.description(),
					null,
					null,
					true) --> here we can set p.complete() instead of true
				)
				.forEach(candidates::add);

This way the class implementing ValueProvider can decide if the proposal is complete or not.
Do you think it could be an improvement in spring shell library ?

Thanks a lot !

@jvalkeal
Copy link
Contributor

Do you have screenshot or something similar to show how it looks like?

@fonimus
Copy link
Author

fonimus commented Aug 25, 2022

Sure !
In this gif example I have written the following command :

@ShellMethod("File command")
public void file(
            @ShellOption(valueProvider = FileValueProvider.class, defaultValue = ShellOption.NULL) File file,
            @ShellOption(valueProvider = ExtendedFileValueProvider.class, defaultValue = ShellOption.NULL) File extended
) {
        info(file);
        info(extended);
}

and we can see that when I set complete=false, the cursor stays put and I can press tab again to follow path ; if I use existing file provider I have to press del key to go back and then press tab.

extended-file-provider

@jvalkeal
Copy link
Contributor

That would be nice addition. If you have a time please make a PR and we can continue from there!

@tincore
Copy link

tincore commented Apr 15, 2023

@jvalkeal Just created this quick PR for this issue. #715

Not to diverge too much. I think that positional parameters do not autocomplete with tab. is this intended?

@jvalkeal jvalkeal added this to the 3.2.0-M1 milestone Jul 25, 2023
@jvalkeal jvalkeal added the type/enhancement Is an enhancement request label Jul 25, 2023
@jvalkeal jvalkeal added for/backport For backporting branch/2.1.x Issue for a branch branch/3.0.x Issue for a branch branch/3.1.x Issue for a branch labels Jul 25, 2023
jvalkeal pushed a commit that referenced this issue Jul 25, 2023
- to allow completing single argument with multiple tab clicks,
  for example file paths.
- Backport #512
- Fixes #836
jvalkeal pushed a commit that referenced this issue Jul 25, 2023
- to allow completing single argument with multiple tab clicks,
  for example file paths.
- Backport #512
- Fixes #835
jvalkeal pushed a commit that referenced this issue Jul 25, 2023
- to allow completing single argument with multiple tab clicks,
  for example file paths.
- Backport #512
- Fixes #834
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch/2.1.x Issue for a branch branch/3.0.x Issue for a branch branch/3.1.x Issue for a branch for/backport For backporting type/enhancement Is an enhancement request
Projects
None yet
Development

No branches or pull requests

3 participants