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

devonfw / IDEasy / 29998786930

23 Jul 2026 10:18AM UTC coverage: 72.545% (+0.05%) from 72.496%
29998786930

Pull #2204

github

web-flow
Merge b7d5ee787 into 5b6cc3011
Pull Request #2204: #2192-support-for-auto-completion-synonyms

4986 of 7598 branches covered (65.62%)

Branch coverage included in aggregate %.

12850 of 16988 relevant lines covered (75.64%)

3.2 hits per line

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

90.0
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 Set<String> alreadyProvided;
32

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

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

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

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

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

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

65
    return this.candidates;
3✔
66
  }
67

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

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

77
  @Override
78
  public void disableSorting() {
79

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

83
  @Override
84
  public void setAlreadyProvided(Set<String> alreadyProvided) {
85

86
    this.alreadyProvided = alreadyProvided;
3✔
87
  }
1✔
88

89
  @Override
90
  public Set<String> getAlreadyProvided() {
91

92
    return this.alreadyProvided;
3✔
93
  }
94

95
  @Override
96
  public String toString() {
97

98
    return this.candidates.toString();
×
99
  }
100

101
}
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