Skip to content

#2192-support-for-auto-completion-synonyms#2204

Open
samuelkos17 wants to merge 3 commits into
devonfw:mainfrom
samuelkos17:feature/2192-support-for-auto-completion-synonyms
Open

#2192-support-for-auto-completion-synonyms#2204
samuelkos17 wants to merge 3 commits into
devonfw:mainfrom
samuelkos17:feature/2192-support-for-auto-completion-synonyms

Conversation

@samuelkos17

@samuelkos17 samuelkos17 commented Jul 23, 2026

Copy link
Copy Markdown

This PR fixes #2192

Implemented changes:

  • Changed the class AutoCompletionRegistry:
    • Changed internal storage from List<String> to List<CompletionEntry> so candidates can be grouped with their synonyms.
    • The add methods now create CompletionEntry-Objects and add them to the entries list
    • The complete() method now delegates to each CompletionEntry.complete(), passing the alreadyProvided set for synonym filtering.
  • Created the class CompletionEntry:
    • Groups a primary candidate with one or more synonyms.
    • complete() skips the entire entry if the candidate or any of its synonyms has already been typed on the command line; otherwise performs normal prefix matching on both the candidate and its synonyms.
  • Changed the interface CompletionCandidateCollector:
    • Added setAlreadyProvided(Set) and getAlreadyProvided() to propagate arguments already typed during the
      current completion cycle.
  • Changed the class CompletionCandidateCollectorDefault:
    • Added an alreadyProvided field with getter/setter to store and retrieve the already-provided set.
  • Changed the class CompletionCandidateCollectorAdapter:
    • Implemented the new setAlreadyProvided/getAlreadyProvided methods, delegating to the wrapped collector.
  • Changed the class AbstractIdeContext:
    • completeCommandlet() now scans all CLI arguments (excluding the completion token) into an alreadyProvided set and
      sets it on the collector before matching properties.
  • Changed the class ToolCommandlet:
    • completeToolArguments() now passes collector.getAlreadyProvided() to the registry's complete() call.
  • Changed the class CompleteTest:
    • Added testSynonymFilteringWithProvidedCanonicalCandidate() and testSynonymFilteringWithProvidedSynonym() to verify that --batch is not suggested when -b has already been provided and vice verca.

Testing instructions

  1. Pull the feature branch to your local workspace.
  2. Follow the instructions in run-ideasy-locally.adoc and run with the following cli-arguments:
    1. complete -b "" -- the output should neither contain -b nor --batch
    2. complete --batch "" -- the output should neither contain -b nor --batch
    3. complete "" -- the output should contain both -b and --batch
  3. Run mvn clean test and make sure that all tests pass.

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
  • 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 Jul 23, 2026
@samuelkos17 samuelkos17 self-assigned this Jul 23, 2026
@samuelkos17 samuelkos17 moved this from 🆕 New to Team Review in IDEasy board Jul 23, 2026
@samuelkos17 samuelkos17 added enhancement New feature or request completion auto-completion in bash or build in CLI labels Jul 23, 2026
@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 29998786930

Coverage increased (+0.05%) to 72.545%

Details

  • Coverage increased (+0.05%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 164 coverage regressions across 4 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

164 previously-covered lines in 4 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/context/AbstractIdeContext.java 127 70.76%
com/devonfw/tools/ide/tool/ToolCommandlet.java 27 74.08%
com/devonfw/tools/ide/completion/CompletionCandidateCollectorAdapter.java 8 0.0%
com/devonfw/tools/ide/completion/CompletionCandidateCollectorDefault.java 2 90.0%

Coverage Stats

Coverage Status
Relevant Lines: 16988
Covered Lines: 12850
Line Coverage: 75.64%
Relevant Branches: 7598
Covered Branches: 4986
Branch Coverage: 65.62%
Branches in Coverage %: Yes
Coverage Strength: 3.2 hits per line

💛 - Coveralls

@Caylipp Caylipp self-assigned this Jul 23, 2026
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 auto-completion synonyms

3 participants