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

devonfw / IDEasy / 30462283487

29 Jul 2026 02:43PM UTC coverage: 72.611% (+0.02%) from 72.593%
30462283487

Pull #2195

github

web-flow
Merge 6f38cfe22 into ec264ffca
Pull Request #2195: #2181: Merge VSCodium plugins folder to VSCode

4997 of 7607 branches covered (65.69%)

Branch coverage included in aggregate %.

12874 of 17005 relevant lines covered (75.71%)

3.21 hits per line

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

84.31
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.List;
6
import java.util.Set;
7

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

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

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

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

29
  /** The {@link #getConfiguredEdition() edition} for VSCodium. */
30
  private static final String EDITION_VSCODIUM = "vscodium";
31

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

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

42
  @Override
43
  protected String getBinaryName() {
44

45
    if (EDITION_VSCODIUM.equals(getConfiguredEdition())) {
5✔
46
      return "codium";
2✔
47
    }
48
    return "code";
2✔
49
  }
50

51

52
  @Override
53
  public boolean installPlugin(ToolPluginDescriptor plugin, Step step, ProcessContext pc) {
54

55
    List<String> extensionsCommands = new ArrayList<>();
4✔
56
    extensionsCommands.add("--force");
4✔
57
    extensionsCommands.add("--install-extension");
4✔
58
    String extensionInstallTarget = plugin.id();
3✔
59
    // If a version number was specified, add it to the extension identifier with the format "extensionId@version"
60
    boolean versionSpecified = (plugin.version() != null) && !plugin.version().isBlank();
11!
61
    if (versionSpecified) {
2✔
62
      extensionInstallTarget = extensionInstallTarget + "@" + plugin.version();
5✔
63
    }
64
    extensionsCommands.add(extensionInstallTarget);
4✔
65
    ProcessResult result = runTool(pc, ProcessMode.DEFAULT_CAPTURE, extensionsCommands);
6✔
66
    if (result.isSuccessful()) {
3!
67
      if (versionSpecified) {
2✔
68
        IdeLogLevel.SUCCESS.log(LOG, "Successfully installed plugin: {} with version: {}", plugin.name(), plugin.version());
17✔
69
      } else {
70
        IdeLogLevel.SUCCESS.log(LOG, "Successfully installed plugin: {}", plugin.name());
11✔
71
      }
72
      step.success();
2✔
73
      return true;
2✔
74
    }
75
    if (versionSpecified) {
×
76
      IdeLogLevel.ERROR.log(LOG, "Failed to install plugin: {} with version: {}", plugin.name(), plugin.version());
×
77
    } else {
78
      IdeLogLevel.ERROR.log(LOG, "Failed to install plugin: {}", plugin.name());
×
79
    }
80
    return false;
×
81
  }
82

83
  @Override
84
  protected void configureToolArgs(ProcessContext pc, ProcessMode processMode, List<String> args) {
85

86
    if (this.context.getSystemInfo().isWsl()) {
5✔
87
      pc.withEnvVar("DONT_PROMPT_WSL_INSTALL", "1");
5✔
88
    }
89
    Path vsCodeConf = this.context.getWorkspacePath().resolve(".vscode/.userdata");
6✔
90
    pc.addArg("--new-window");
4✔
91
    pc.addArg("--user-data-dir=" + vsCodeConf);
6✔
92
    Path vsCodeExtensionFolder = this.context.getIdeHome().resolve("plugins/vscode");
6✔
93
    pc.addArg("--extensions-dir=" + vsCodeExtensionFolder);
6✔
94
    pc.addArg(this.context.getWorkspacePath());
6✔
95
    super.configureToolArgs(pc, processMode, args);
5✔
96
  }
1✔
97

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