#2131: improve auto completion for ide upgrade mode - #2164
Conversation
Add enum value completion for `ide upgrade --mode` and keep the implementation local to `UpgradeModeProperty`.
Preserve `--mode=` in shell completion so `ide upgrade --mode` can offer enum value suggestions correctly.
Coverage Report for CI Build 30345035967Coverage increased (+0.02%) to 72.626%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
|
Please also change the title of this PR to follow the rules of DoD:
|
…ch, and no-match behavior of upgrade mode completion.
|
This pr can move forward. The changes are looking fine and the suggestions are applied. |
| super(context); | ||
| addKeyword(getName()); | ||
| this.mode = add(new EnumProperty<>("--mode", false, null, UpgradeMode.class)); | ||
| this.mode = add(new UpgradeModeProperty()); |
There was a problem hiding this comment.
No need not create a new custom property for this. The idea of the story was not specifically to create auto-completion only for the upgrade mode but for all properties that have distinct values.
So in --«option»=«value» completion for «value».
Simply implement the completeValue in EnumProperty and you solve the issue for all usages of EnumProperty.
What also wonders me is that for ide sonar [TAB] this is already working so my assumption was that the only problem remaining was the handling of = that you IMHO already solved with your small change in functions.
Please try if it also works without this new property.
There was a problem hiding this comment.
Good point. I’ll move the value completion into EnumProperty so it applies to all enum-backed properties, and remove the custom UpgradeModeProperty.
hohwille
left a comment
There was a problem hiding this comment.
We almost got it nailed.
Still some last things to complete.
| Release with new features and bugfixes: | ||
|
|
||
| * https://github.com/devonfw/IDEasy/issues/2131[#2131]: Improve `ide upgrade --mode=` auto-completion | ||
| * https://github.com/devonfw/IDEasy/issues/2039[#2039]: IDE logo not shown in mac task bar |
|
|
||
| @Override | ||
| protected void completeValue(String arg, IdeContext context, Commandlet commandlet, CompletionCandidateCollector collector) { | ||
| public void completeValue(String arg, IdeContext context, Commandlet commandlet, CompletionCandidateCollector collector) { |
There was a problem hiding this comment.
why do we need to change visiblity?
For testing?
Actually white-box testing of EnumProperty should be done in EnumPropertyTest in the same package what allows accessing default and protected visibility.

This PR fixes #2131
Implemented changes:
EnumProperty--modeinUpgradeCommandlet--mode=s)--key=value)Testing instructions
Ensure the newly built executable is picked up (restart shell if needed).
Expected output:
--mode=snapshot --mode=stable --mode=unstableThe suggested values correspond to all predefined values of the UpgradeMode enum.
Expected output:
--mode=snapshot --mode=stableExpected output: the command is automatically completed with the matched value.
ide upgrade --mode=stableChecklist for this PR
Make sure everything is checked before merging this PR. For further info please also see
our DoD.
mvn clean testlocally all tests pass and build is successful#«issue-id»: «brief summary»(e.g.#921: fixed setup.bat). If no issue ID exists, title only.In Progressand assigned to you or there is no issue (might happen for very small PRs)with
internal