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

devonfw / IDEasy / 19751480105

28 Nov 2025 01:26AM UTC coverage: 69.441% (+0.3%) from 69.136%
19751480105

push

github

web-flow
#1613: fixed duplicated CVE check and refactored installation routine (#1614)

3696 of 5851 branches covered (63.17%)

Branch coverage included in aggregate %.

9620 of 13325 relevant lines covered (72.2%)

3.14 hits per line

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

86.11
cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java
1
package com.devonfw.tools.ide.tool.vscode;
2

3
import java.nio.file.Path;
4
import java.util.ArrayList;
5
import java.util.Collection;
6
import java.util.List;
7
import java.util.Set;
8

9
import com.devonfw.tools.ide.common.Tag;
10
import com.devonfw.tools.ide.context.IdeContext;
11
import com.devonfw.tools.ide.io.IdeProgressBar;
12
import com.devonfw.tools.ide.process.ProcessContext;
13
import com.devonfw.tools.ide.process.ProcessMode;
14
import com.devonfw.tools.ide.process.ProcessResult;
15
import com.devonfw.tools.ide.step.Step;
16
import com.devonfw.tools.ide.tool.ToolCommandlet;
17
import com.devonfw.tools.ide.tool.ide.IdeToolCommandlet;
18
import com.devonfw.tools.ide.tool.plugin.ToolPluginDescriptor;
19

20
/**
21
 * {@link ToolCommandlet} for <a href="https://code.visualstudio.com/">vscode</a>.
22
 */
23
public class Vscode extends IdeToolCommandlet {
24

25
  /**
26
   * The constructor.
27
   *
28
   * @param context the {@link IdeContext}.
29
   */
30
  public Vscode(IdeContext context) {
31

32
    super(context, "vscode", Set.of(Tag.VS_CODE));
6✔
33
  }
1✔
34

35
  @Override
36
  protected String getBinaryName() {
37

38
    return "code";
2✔
39
  }
40

41
  @Override
42
  protected void installPlugins(Collection<ToolPluginDescriptor> plugins, ProcessContext pc) {
43
    this.context.runWithoutLogging(() -> {
7✔
44
      IdeProgressBar pb = this.context.newProgressBarForPlugins(plugins.size());
7✔
45
      pc.setOutputListener((msg, err) -> {
4✔
46
        if (msg.contains("Installing extension ")) {
4!
47
          pb.stepBy(1);
×
48
        }
49
      });
1✔
50
      super.installPlugins(plugins, pc);
4✔
51
      pb.close();
2✔
52
    });
1✔
53
  }
1✔
54

55
  @Override
56
  public boolean installPlugin(ToolPluginDescriptor plugin, Step step, ProcessContext pc) {
57

58
    List<String> extensionsCommands = new ArrayList<>();
4✔
59
    extensionsCommands.add("--force");
4✔
60
    extensionsCommands.add("--install-extension");
4✔
61
    extensionsCommands.add(plugin.id());
5✔
62
    ProcessResult result = runTool(pc, ProcessMode.DEFAULT_CAPTURE, extensionsCommands.toArray(String[]::new));
12✔
63
    if (result.isSuccessful()) {
3!
64
      this.context.success("Successfully installed plugin: {}", plugin.name());
11✔
65
      step.success();
2✔
66
      return true;
2✔
67
    } else {
68
      this.context.warning("An error occurred while installing plugin: {}", plugin.name());
×
69
      return false;
×
70
    }
71
  }
72

73
  @Override
74
  protected void configureToolArgs(ProcessContext pc, ProcessMode processMode, String... args) {
75

76
    Path vsCodeConf = this.context.getWorkspacePath().resolve(".vscode/.userdata");
6✔
77
    pc.addArg("--new-window");
4✔
78
    pc.addArg("--user-data-dir=" + vsCodeConf);
6✔
79
    Path vsCodeExtensionFolder = this.context.getIdeHome().resolve("plugins/vscode");
6✔
80
    pc.addArg("--extensions-dir=" + vsCodeExtensionFolder);
6✔
81
    pc.addArg(this.context.getWorkspacePath());
6✔
82
    super.configureToolArgs(pc, processMode, args);
5✔
83
  }
1✔
84

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