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

Exit is completed in wrong places #836

Open
WorkingAmeise opened this issue Dec 5, 2024 · 1 comment
Open

Exit is completed in wrong places #836

WorkingAmeise opened this issue Dec 5, 2024 · 1 comment
Labels
bug Something isn't working shell build-in shell with advanced completion

Comments

@WorkingAmeise
Copy link
Contributor

Expected behavior

As a IDEasy-shell-user , I only want exit to be suggested or autocompleted when it would be the only argument.

Actual behavior

exit is completed everywhere and even when there is no character typed. Strangely it also autocompletes to exit when you type a character other than "e".

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. Call ide shell

  2. intellij -> intellij exit

  3. intellij -> intellij exit exit exit

  4. Call ide shell

  5. z -> exit

Related/Dependent Issues

Completion of exit only in ide shell was implemented in issue #533

Comments/Hints:

Affected version:

  • OS: All
  • Browser: /
@WorkingAmeise WorkingAmeise added bug Something isn't working shell build-in shell with advanced completion labels Dec 5, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Dec 5, 2024
@hohwille
Copy link
Member

hohwille commented Dec 5, 2024

Indeed new StringsCompleter("exit") was the wrong approach:

Completer completer = new AggregateCompleter(
new StringsCompleter("exit"), new IdeCompleter((AbstractIdeContext) this.context));

These kind of completer from JLine is stupid and useless for us since it is not context sensitive. We need to integrate the completion of exit here:

public void complete(LineReader reader, ParsedLine commandLine, List<Candidate> candidates) {
List<String> words = commandLine.words();
CliArguments args = CliArguments.ofCompletion(words.toArray(String[]::new));
List<CompletionCandidate> completion = this.context.complete(args, false);
int i = 0;
for (CompletionCandidate candidate : completion) {
candidates.add(new Candidate(candidate.text(), candidate.text(), null, null, null, null, true, i++));
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working shell build-in shell with advanced completion
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants