-
Notifications
You must be signed in to change notification settings - Fork 45
Fix IDEasy complete double-matching issue by preventing duplicate candidates #1408
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
base: main
Are you sure you want to change the base?
Conversation
|
|
Co-authored-by: maybeec <1427255+maybeec@users.noreply.github.com>
…didates Co-authored-by: maybeec <1427255+maybeec@users.noreply.github.com>
Co-authored-by: maybeec <1427255+maybeec@users.noreply.github.com>
Pull Request Test Coverage Report for Build 16294769564Details
💛 - Coveralls |
cli/src/test/java/com/devonfw/tools/ide/commandlet/CompleteCommandletTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR prevents duplicate completion candidates by checking for existing texts before adding new ones and adds tests to verify no duplicates across various scenarios.
- Added duplicate check in
CompletionCandidateCollectorDefault.add()to skip candidates with existing text - Introduced new tests (
CompletionDuplicateTest,CompleteCommandletTest,Issue536Test) to ensure no duplicate suggestions are produced
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| cli/src/main/java/com/devonfw/tools/ide/completion/CompletionCandidateCollectorDefault.java | Added loop to detect existing candidate text and return early |
| cli/src/test/java/com/devonfw/tools/ide/completion/CompletionDuplicateTest.java | New test covering multiple input prefixes to confirm no duplicates |
| cli/src/test/java/com/devonfw/tools/ide/commandlet/CompleteCommandletTest.java | New test verifying CompleteCommandlet output has no repeated lines |
| cli/src/test/java/com/devonfw/tools/ide/completion/Issue536Test.java | New test for the specific ide complete in scenario |
Comments suppressed due to low confidence (1)
cli/src/main/java/com/devonfw/tools/ide/completion/CompletionCandidateCollectorDefault.java:38
- Add a unit test that tries to add two candidates with the same
textbut differentdescriptionorpropertyto verify the duplicate prevention logic works as intended.
// Check if this candidate already exists to avoid duplicates
cli/src/test/java/com/devonfw/tools/ide/completion/CompletionDuplicateTest.java
Show resolved
Hide resolved
cli/src/test/java/com/devonfw/tools/ide/commandlet/CompleteCommandletTest.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/completion/CompletionCandidateCollectorDefault.java
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/completion/CompletionCandidateCollectorDefault.java
Show resolved
Hide resolved
…andletTest Co-authored-by: maybeec <1427255+maybeec@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Problem
IDEasy complete was matching commandlets twice during the completion process, potentially causing duplicate completion candidates to be shown to users. This happened because:
CommandletFinder.findNext()callsproperty.apply()which adds completion candidates during the commandlet finding phaseAbstractIdeContext.complete()then callscompleteCommandlet()which may add the same candidates againSolution
Added duplicate prevention logic in
CompletionCandidateCollectorDefault.add()to check if a candidate with the same text already exists before adding it. This prevents duplicate completion candidates from being added to the collector.Changes Made
CompletionCandidateCollectorDefault.add()to check for existing candidates with the same text before adding new onesCompletionDuplicateTest- general duplicate prevention testingCompleteCommandletTest- specific test for theCompleteCommandletIssue536Test- test for the specific scenario mentioned in the issue (ide complete in)Testing
ide complete inBenefits
The fix ensures that users see clean, duplicate-free completion suggestions when using IDEasy's auto-completion feature.
Fixes #536.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com/usr/lib/apt/methods/https(dns block)mobeigi.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.10/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.10/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.10 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.10/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/IDEasy/IDEasy org.codehaus.plexus.classworlds.launcher.Launcher clean compile test-compile(dns block)www.github.com/usr/lib/jvm/java-21-openjdk-amd64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/jacoco/org.jacoco.agent/0.8.13/org.jacoco.agent-0.8.13-runtime.jar=destfile=/home/REDACTED/work/IDEasy/IDEasy/cli/target/jacoco.exec -jar /home/REDACTED/work/IDEasy/IDEasy/cli/target/surefire/surefirebooter-20250715130859707_3.jar /home/REDACTED/work/IDEasy/IDEasy/cli/target/surefire 2025-07-15T13-08-59_595-jvmRun1 surefire-20250715130859707_1tmp surefire_0-20250715130859707_2tmp(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.