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

devonfw / IDEasy / 22300285724

23 Feb 2026 09:32AM UTC coverage: 70.754% (+0.3%) from 70.474%
22300285724

Pull #1714

github

web-flow
Merge caa980897 into 379acdc9d
Pull Request #1714: #404: #1713: advanced logging

4064 of 6348 branches covered (64.02%)

Branch coverage included in aggregate %.

10640 of 14434 relevant lines covered (73.71%)

3.1 hits per line

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

88.89
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

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

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

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

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

21
  private final List<CompletionCandidate> candidates;
22

23
  private final IdeContext context;
24

25
  private boolean sortCandidates;
26

27
  /**
28
   * The constructor.
29
   *
30
   * @param context the {@link IdeContext}.
31
   */
32
  public CompletionCandidateCollectorDefault(IdeContext context) {
33

34
    super();
2✔
35
    this.candidates = new ArrayList<>();
5✔
36
    this.context = context;
3✔
37
    this.sortCandidates = true;
3✔
38
  }
1✔
39

40
  @Override
41
  public void add(String text, String description, Property<?> property, Commandlet commandlet) {
42

43
    // Check if this candidate already exists to avoid duplicates
44
    for (CompletionCandidate existing : this.candidates) {
11✔
45
      if (existing.text().equals(text)) {
5!
46
        // Duplicate candidate found, do not add
47
        return;
×
48
      }
49
    }
1✔
50

51
    CompletionCandidate candidate = createCandidate(text, description, property, commandlet);
7✔
52
    this.candidates.add(candidate);
5✔
53
    LOG.trace("Added {} for auto-completion of property {}.{}", candidate, commandlet, property);
17✔
54
  }
1✔
55

56
  @Override
57
  public List<CompletionCandidate> getCandidates() {
58

59
    return this.candidates;
3✔
60
  }
61

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

65
    if (this.sortCandidates) {
3✔
66
      Collections.sort(this.candidates);
3✔
67
    }
68
    return this.candidates;
3✔
69
  }
70

71
  @Override
72
  public void disableSorting() {
73

74
    this.sortCandidates = false;
3✔
75
  }
1✔
76

77
  @Override
78
  public String toString() {
79

80
    return this.candidates.toString();
×
81
  }
82

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

© 2026 Coveralls, Inc