Skip to content

#2193: add alternatives and dependencies to auto-completion entries - #2390

Open
Hiepiscus wants to merge 10 commits into
devonfw:mainfrom
Hiepiscus:2193-support-for-conditional-auto-completion
Open

#2193: add alternatives and dependencies to auto-completion entries#2390
Hiepiscus wants to merge 10 commits into
devonfw:mainfrom
Hiepiscus:2193-support-for-conditional-auto-completion

Conversation

@Hiepiscus

@Hiepiscus Hiepiscus commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #2193

This PR extends the auto-completion model with support for alternatives and dependencies between CompletionEntry objects.

Implemented changes:

  • Extended CompletionEntry with alternative relationships.
    • Alternatives remain separate completion entries because they are different commands.
    • The relationship is symmetric, so adding one entry as an alternative links both entries.
    • Once one alternative or one of its synonyms has already been provided, the other entry is no longer suggested.
  • Extended CompletionEntry with dependency groups.
    • Dependencies use OR logic within one group.
    • Multiple dependency groups use AND logic.
    • A completion entry is only suggested when every configured dependency group is satisfied.
    • Candidates and their synonyms are both considered when checking whether a dependency is satisfied.
  • Addd convenience methods to AutoCompletionRegistry.
    • addAlternative(String, String) connects two previously registered completion entries.
    • addDependency(String, List<String>) registers an OR-dependency group for a previously registered entry.
    • Both methods fail with an IllegalStateException if a referenced candidate has not been registered with add(String).
  • Changed Maven completion.
    • exec:java and exec:exec are registered as alternatives.
    • -Dexec.mainClass= depends on exec:java.
    • -Dexec.args= depends on either exec:java or exec:exec.
  • Changed CompleteTest:
    • Add tests for alternative candidates and dependency completion filtering.

Testing instructions

  1. Run build-local-dev.sh
  2. In the console type ide mvn exec:exec and use the auto completion with <tab><tab>
  3. Verify that the output should not contain exec:java
  4. Type ide mvn -D and use <tab><tab>
  5. Verify that -Dexec.mainClass= or -Dexec.args is not in the output
  6. Type ide mvn exec:java -D and use `
  7. Verify that the output should contain -Dexec.mainClass= or -Dexec.args
  8. Type ide mvn exec:exec -D and use <tab><tab>
  9. Verify that the output should only contain -Dexec.args

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 and not feature/921 fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summaries 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 labelled
    with internal
  • You have not changed any dependency in pom.xml files or otherwise if runtime dependencies changed, you have updated our LICENSE.asciidoc
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Aug 31, 2026
@Hiepiscus Hiepiscus added enhancement New feature or request completion auto-completion in bash or build in CLI labels Aug 31, 2026
@Hiepiscus Hiepiscus moved this from 🆕 New to Team Review in IDEasy board Aug 31, 2026
@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 33372059770

Coverage decreased (-0.009%) to 73.619%

Details

  • Coverage decreased (-0.009%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 10 coverage regressions across 4 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

10 previously-covered lines in 4 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/completion/AutoCompletionRegistry.java 4 82.0%
com/devonfw/tools/ide/version/VersionSegment.java 3 89.5%
com/devonfw/tools/ide/completion/CompletionEntry.java 2 89.89%
com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java 1 87.42%

Coverage Stats

Coverage Status
Relevant Lines: 18419
Covered Lines: 14179
Line Coverage: 76.98%
Relevant Branches: 8176
Covered Branches: 5400
Branch Coverage: 66.05%
Branches in Coverage %: Yes
Coverage Strength: 3.28 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

completion auto-completion in bash or build in CLI enhancement New feature or request

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

Support for conditional auto-completion

3 participants