• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 30532321896

30 Jul 2026 09:50AM UTC coverage: 72.592% (-0.001%) from 72.593%
30532321896

Pull #2204

github

web-flow
Merge 3ede9fc31 into ec264ffca
Pull Request #2204: #2192-support-for-auto-completion-synonyms

5000 of 7617 branches covered (65.64%)

Branch coverage included in aggregate %.

12888 of 17025 relevant lines covered (75.7%)

3.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

89.66
cli/src/main/java/com/devonfw/tools/ide/completion/CompletionCandidateCollectorDefault.java
1
package com.devonfw.tools.ide.completion;
2

3
import java.util.ArrayList;
4
import java.util.Collections;
5
import java.util.List;
6
import java.util.Set;
7

8
import org.slf4j.Logger;
9
import org.slf4j.LoggerFactory;
10

11
import com.devonfw.tools.ide.commandlet.Commandlet;
12
import com.devonfw.tools.ide.context.IdeContext;
13
import com.devonfw.tools.ide.property.Property;
14

15
/**
16
 * Collects the {@link CompletionCandidate}s for auto-completion.
17
 */
18
public class CompletionCandidateCollectorDefault implements CompletionCandidateCollector {
19

20
  private static final Logger LOG = LoggerFactory.getLogger(CompletionCandidateCollectorDefault.class);
4✔
21

22
  private final List<CompletionCandidate> candidates;
23

24
  private final IdeContext context;
25

26
  private boolean sortCandidates;
27

28
  /**
29
   * The set of arguments that have already been provided on the command line.
30
   */
31
  private final Set<String> alreadyProvided;
32

33
  /**
34
   * The constructor.
35
   *
36
   * @param context the {@link IdeContext}.
37
   */
38
  public CompletionCandidateCollectorDefault(IdeContext context, Set<String> alreadyProvided) {
39

40
    super();
2✔
41
    this.alreadyProvided = Collections.unmodifiableSet(alreadyProvided);
4✔
42
    this.candidates = new ArrayList<>();
5✔
43
    this.context = context;
3✔
44
    this.sortCandidates = true;
3✔
45
  }
1✔
46

47
  @Override
48
  public void add(String text, String description, Property<?> property, Commandlet commandlet) {
49

50
    // Check if this candidate already exists to avoid duplicates
51
    for (CompletionCandidate existing : this.candidates) {
11✔
52
      if (existing.text().equals(text)) {
5!
53
        // Duplicate candidate found, do not add
54
        return;
×
55
      }
56
    }
1✔
57

58
    CompletionCandidate candidate = createCandidate(text, description, property, commandlet);
7✔
59
    this.candidates.add(candidate);
5✔
60
    LOG.trace("Added {} for auto-completion of property {}.{}", candidate, commandlet, property);
17✔
61
  }
1✔
62

63
  @Override
64
  public List<CompletionCandidate> getCandidates() {
65

66
    return this.candidates;
3✔
67
  }
68

69
  @Override
70
  public List<CompletionCandidate> getSortedCandidates() {
71

72
    if (this.sortCandidates) {
3✔
73
      Collections.sort(this.candidates);
3✔
74
    }
75
    return this.candidates;
3✔
76
  }
77

78
  @Override
79
  public void disableSorting() {
80

81
    this.sortCandidates = false;
3✔
82
  }
1✔
83

84
  @Override
85
  public Set<String> getAlreadyProvided() {
86

87
    return this.alreadyProvided;
3✔
88
  }
89

90
  @Override
91
  public String toString() {
92

93
    return this.candidates.toString();
×
94
  }
95

96
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc