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

devonfw / IDEasy / 22283847745

22 Feb 2026 07:34PM UTC coverage: 70.75% (+0.3%) from 70.474%
22283847745

Pull #1714

github

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

4064 of 6348 branches covered (64.02%)

Branch coverage included in aggregate %.

10635 of 14428 relevant lines covered (73.71%)

3.1 hits per line

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

86.49
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 org.slf4j.Logger;
10
import org.slf4j.LoggerFactory;
11

12
import com.devonfw.tools.ide.common.Tag;
13
import com.devonfw.tools.ide.context.IdeContext;
14
import com.devonfw.tools.ide.io.IdeProgressBar;
15
import com.devonfw.tools.ide.log.IdeLogLevel;
16
import com.devonfw.tools.ide.process.ProcessContext;
17
import com.devonfw.tools.ide.process.ProcessMode;
18
import com.devonfw.tools.ide.process.ProcessResult;
19
import com.devonfw.tools.ide.step.Step;
20
import com.devonfw.tools.ide.tool.ToolCommandlet;
21
import com.devonfw.tools.ide.tool.ide.IdeToolCommandlet;
22
import com.devonfw.tools.ide.tool.plugin.ToolPluginDescriptor;
23

24
/**
25
 * {@link ToolCommandlet} for <a href="https://code.visualstudio.com/">vscode</a>.
26
 */
27
public class Vscode extends IdeToolCommandlet {
28

29
  private static final Logger LOG = LoggerFactory.getLogger(Vscode.class);
4✔
30

31
  /**
32
   * The constructor.
33
   *
34
   * @param context the {@link IdeContext}.
35
   */
36
  public Vscode(IdeContext context) {
37

38
    super(context, "vscode", Set.of(Tag.VS_CODE));
6✔
39
  }
1✔
40

41
  @Override
42
  protected String getBinaryName() {
43

44
    return "code";
2✔
45
  }
46

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

61
  @Override
62
  public boolean installPlugin(ToolPluginDescriptor plugin, Step step, ProcessContext pc) {
63

64
    List<String> extensionsCommands = new ArrayList<>();
4✔
65
    extensionsCommands.add("--force");
4✔
66
    extensionsCommands.add("--install-extension");
4✔
67
    extensionsCommands.add(plugin.id());
5✔
68
    ProcessResult result = runTool(pc, ProcessMode.DEFAULT_CAPTURE, extensionsCommands);
6✔
69
    if (result.isSuccessful()) {
3!
70
      LOG.info(IdeLogLevel.SUCCESS.getSlf4jMarker(), "Successfully installed plugin: {}", plugin.name());
7✔
71
      step.success();
2✔
72
      return true;
2✔
73
    } else {
74
      LOG.warn("An error occurred while installing plugin: {}", plugin.name());
×
75
      return false;
×
76
    }
77
  }
78

79
  @Override
80
  protected void configureToolArgs(ProcessContext pc, ProcessMode processMode, List<String> args) {
81

82
    Path vsCodeConf = this.context.getWorkspacePath().resolve(".vscode/.userdata");
6✔
83
    pc.addArg("--new-window");
4✔
84
    pc.addArg("--user-data-dir=" + vsCodeConf);
6✔
85
    Path vsCodeExtensionFolder = this.context.getIdeHome().resolve("plugins/vscode");
6✔
86
    pc.addArg("--extensions-dir=" + vsCodeExtensionFolder);
6✔
87
    pc.addArg(this.context.getWorkspacePath());
6✔
88
    super.configureToolArgs(pc, processMode, args);
5✔
89
  }
1✔
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