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

devonfw / IDEasy / 29835901509

21 Jul 2026 01:45PM UTC coverage: 72.507% (+0.03%) from 72.476%
29835901509

Pull #2195

github

web-flow
Merge 3d9a8f6cc into 3221b7580
Pull Request #2195: #2181: Merge VSCodium plugins folder to VSCode

4952 of 7550 branches covered (65.59%)

Branch coverage included in aggregate %.

12786 of 16914 relevant lines covered (75.59%)

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.Files;
4
import java.nio.file.Path;
5
import java.util.ArrayList;
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.log.IdeLogLevel;
15
import com.devonfw.tools.ide.process.ProcessContext;
16
import com.devonfw.tools.ide.process.ProcessMode;
17
import com.devonfw.tools.ide.process.ProcessResult;
18
import com.devonfw.tools.ide.step.Step;
19
import com.devonfw.tools.ide.tool.ToolCommandlet;
20
import com.devonfw.tools.ide.tool.ide.IdeToolCommandlet;
21
import com.devonfw.tools.ide.tool.plugin.ToolPluginDescriptor;
22

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

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

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

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

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

43
  @Override
44
  protected String getBinaryName() {
45

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

52
  @Override
53
  protected Path getPluginsConfigPath() {
54
    // Kept for potential backward-compatibility fallback
55

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

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

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

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

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

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