Open gaetPax opened 5 years ago
This always true assignment seems to currently be at CompleterAutoConfiguration
@Override
public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) {
CompletingParsedLine cpl = (line instanceof CompletingParsedLine) ? ((CompletingParsedLine) line) : t -> t;
CompletionContext context = new CompletionContext(sanitizeInput(line.words()), line.wordIndex(), line.wordCursor(), null, null);
List<CompletionProposal> proposals = shell.complete(context);
proposals.stream()
.map(p -> new Candidate(
p.dontQuote() ? p.value() : cpl.emit(p.value()).toString(),
p.displayText(),
p.category(),
p.description(),
null,
null,
true) // <----- COMPLETE ALWAYS TRUE
)
.forEach(candidates::add);
}
Currently, when selecting an option through auto-complete (implemented with ValueProvider), the selected option will always put a a space in the command line after the selected option. This is not always the desired behaviour, especially when autocompleting a file path (i.e. using the FileValueProvider). You would like to go deeper into the path and keep the cursor on the last character.
I think this occurs because the 'complete' field when instantiating the 'Candidate' Jline classes is always set to true in the 'CompleterAdapter' class: https://github.com/spring-projects/spring-shell/blob/master/spring-shell-core/src/main/java/org/springframework/shell/jline/JLineShellAutoConfiguration.java#L217
This behaviour should be parametrised.