Skip to content

#836: fix exit autocompletion#1950

Open
Caylipp wants to merge 2 commits into
devonfw:mainfrom
Caylipp:feature/836-fix-exit-autocomplete
Open

#836: fix exit autocompletion#1950
Caylipp wants to merge 2 commits into
devonfw:mainfrom
Caylipp:feature/836-fix-exit-autocomplete

Conversation

@Caylipp
Copy link
Copy Markdown

@Caylipp Caylipp commented May 18, 2026

This PR fixes #836

Implemented changes:

  • fixed autocomplete behavior for exit command
  • ensured exit is only suggested in valid context

How to Test:

Run in Git Bash:

mvn -pl cli exec:java -Dexec.mainClass=com.devonfw.tools.ide.cli.Ideasy -Dexec.args="shell"

Then verify:

  • e<TAB> -> suggests exit
  • <TAB> with empty input -> no exit
  • z<TAB> -> no exit
  • after other commands (intellij e<TAB>) -> no exit

Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled
    with internal

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 18, 2026

CLA assistant check
All committers have signed the CLA.

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented May 18, 2026

Coverage Report for CI Build 26149130916

Warning

No base build found for commit 908c0a7 on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 70.947%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 15515
Covered Lines: 11479
Line Coverage: 73.99%
Relevant Branches: 6934
Covered Branches: 4448
Branch Coverage: 64.15%
Branches in Coverage %: Yes
Coverage Strength: 3.13 hits per line

💛 - Coveralls

@hohwille hohwille moved this from 🆕 New to Team Review in IDEasy board May 18, 2026
@Caylipp Caylipp added the shell build-in shell with advanced completion label May 18, 2026
Comment on lines -97 to -100
line = line.trim();
if (line.equals("exit")) {
return;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the completion but the actual functionality that exit works as command and actually ends the shell.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I restored/kept this part in ShellCommandlet since it is the actual shell exit handling and not part of the completion logic.

Comment on lines +84 to +86
if (wordIndex == 0 && !currentWord.isEmpty() && "exit".startsWith(currentWord)) {
candidates.add(new Candidate("exit"));
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You fix looks good but why did you not simply put this fix inside IdeCompleter instead of building an anonymous wrapper class around it?
IMHO you can also return after completing exit (and not continue with the generic completion).

Finally, I would suggest to create a constant for "exit" this is required 3x in this code.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I removed the anonymous completer wrapper, moved the exit completion logic into IdeCompleter, and added an EXIT_COMMAND constant.

I kept the generic completion running after adding the exit candidate so that possible commandlets with the same prefix are not skipped.
image

Caylipp added 2 commits May 20, 2026 09:47
- restored exit command handling since it is actual shell functionality
- removed anonymous completer wrapper
- moved exit completion logic into IdeCompleter
- added EXIT_COMMAND constant
@Caylipp Caylipp force-pushed the feature/836-fix-exit-autocomplete branch from d7b4d41 to d09cc84 Compare May 20, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shell build-in shell with advanced completion

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

Exit is completed in wrong places

5 participants