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

devonfw / IDEasy / 26101908636

19 May 2026 01:55PM UTC coverage: 70.982% (+0.003%) from 70.979%
26101908636

Pull #1859

github

web-flow
Merge cf4a7f717 into b4eeee25f
Pull Request #1859: #1392: Smart completions

4472 of 6964 branches covered (64.22%)

Branch coverage included in aggregate %.

11521 of 15567 relevant lines covered (74.01%)

3.14 hits per line

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

94.87
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(CompletionCandidate completion) {
42
    for (CompletionCandidate existing : this.candidates) {
11✔
43
      if (existing.text().equals(completion.text())) {
6✔
44
        return;
1✔
45
      }
46
    }
1✔
47

48
    this.candidates.add(completion);
5✔
49
  }
1✔
50

51
  @Override
52
  public void add(String text, String description) {
53
    for (CompletionCandidate existing : this.candidates) {
11✔
54
      if (existing.text().equals(text)) {
5✔
55
        return;
1✔
56
      }
57
    }
1✔
58

59
    CompletionCandidate candidate = this.createCandidate(text, description, !text.endsWith("="));
11!
60
    this.candidates.add(candidate);
5✔
61

62
    LOG.trace("Added {} for auto-completion.", candidate);
4✔
63
  }
1✔
64

65
  @Override
66
  public List<CompletionCandidate> getCandidates() {
67

68
    return this.candidates;
3✔
69
  }
70

71
  @Override
72
  public List<CompletionCandidate> getSortedCandidates() {
73

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

80
  @Override
81
  public void disableSorting() {
82

83
    this.sortCandidates = false;
3✔
84
  }
1✔
85

86
  @Override
87
  public String toString() {
88

89
    return this.candidates.toString();
×
90
  }
91
}
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