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

devonfw / IDEasy / 30072174238

24 Jul 2026 06:24AM UTC coverage: 72.588% (+0.03%) from 72.561%
30072174238

Pull #2195

github

web-flow
Merge 2561b9c45 into dd45e9162
Pull Request #2195: #2181: Merge VSCodium plugins folder to VSCode

4985 of 7588 branches covered (65.7%)

Branch coverage included in aggregate %.

12839 of 16967 relevant lines covered (75.67%)

3.2 hits per line

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

84.62
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
  @Override
52
  protected Path getPluginsConfigPath() {
53
    // Kept for potential backward-compatibility fallback
54

55
    return super.getPluginsConfigPath();
3✔
56
  }
57

58
  @Override
59
  public boolean installPlugin(ToolPluginDescriptor plugin, Step step, ProcessContext pc) {
60

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

89
  @Override
90
  protected void configureToolArgs(ProcessContext pc, ProcessMode processMode, List<String> args) {
91

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

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