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

devonfw / IDEasy / 25486278886

07 May 2026 08:59AM UTC coverage: 70.72% (-0.008%) from 70.728%
25486278886

Pull #1888

github

web-flow
Merge 5b719a80e into 2e54dfef7
Pull Request #1888: #1849: Add support for VSCodium

4414 of 6892 branches covered (64.05%)

Branch coverage included in aggregate %.

11377 of 15437 relevant lines covered (73.7%)

3.12 hits per line

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

78.13
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.ProcessErrorHandling;
18
import com.devonfw.tools.ide.process.ProcessMode;
19
import com.devonfw.tools.ide.process.ProcessResult;
20
import com.devonfw.tools.ide.step.Step;
21
import com.devonfw.tools.ide.tool.ToolCommandlet;
22
import com.devonfw.tools.ide.tool.ide.IdeToolCommandlet;
23
import com.devonfw.tools.ide.tool.plugin.ToolPluginDescriptor;
24

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

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

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

35
  /** Plugin IDs collected during {@link #installPlugins} that the VSCodium build refused to install. */
36
  private final List<String> vscodiumUnavailablePlugins = new ArrayList<>();
5✔
37

38
  /**
39
   * The constructor.
40
   *
41
   * @param context the {@link IdeContext}.
42
   */
43
  public Vscode(IdeContext context) {
44

45
    super(context, "vscode", Set.of(Tag.VS_CODE));
6✔
46
  }
1✔
47

48
  @Override
49
  protected String getBinaryName() {
50

51
    if (EDITION_VSCODIUM.equals(getConfiguredEdition())) {
5✔
52
      return "codium";
2✔
53
    }
54
    return "code";
2✔
55
  }
56

57
  @Override
58
  protected void installPlugins(Collection<ToolPluginDescriptor> plugins, ProcessContext pc) {
59
    boolean isVscodium = EDITION_VSCODIUM.equals(getConfiguredEdition());
5✔
60
    if (isVscodium) {
2✔
61
      this.vscodiumUnavailablePlugins.clear();
3✔
62
      pc.errorHandling(ProcessErrorHandling.NONE);
4✔
63
    }
64
    IdeLogLevel suppressLevel = isVscodium ? IdeLogLevel.WARNING : IdeLogLevel.STEP;
6✔
65
    this.context.runWithoutLogging(() -> {
8✔
66
      IdeProgressBar pb = this.context.newProgressBarForPlugins(plugins.size());
7✔
67
      pc.setOutputListener((msg, err) -> {
4✔
68
        if (msg.contains("Installing extension ")) {
4!
69
          pb.stepBy(1);
×
70
        }
71
      });
1✔
72
      super.installPlugins(plugins, pc);
4✔
73
      pb.close();
2✔
74
    }, suppressLevel);
1✔
75
    if (isVscodium && !this.vscodiumUnavailablePlugins.isEmpty()) {
6!
76
      LOG.warn("{} plugin(s) could not be installed on VSCodium due to not being available on open-vsx or other errors:\n  - {}\n"
×
77
              + "For full plugin support, set VSCODE_EDITION=vscode to use Microsoft's distribution.\n"
78
              + "For more detailed information on why plugins failed to install, check the IDEasy logfile at $IDE_ROOT/_ide/logs/.",
79
          this.vscodiumUnavailablePlugins.size(),
×
80
          String.join("\n  - ", this.vscodiumUnavailablePlugins));
×
81
    }
82
  }
1✔
83

84
  @Override
85
  public boolean installPlugin(ToolPluginDescriptor plugin, Step step, ProcessContext pc) {
86

87
    List<String> extensionsCommands = new ArrayList<>();
4✔
88
    extensionsCommands.add("--force");
4✔
89
    extensionsCommands.add("--install-extension");
4✔
90
    extensionsCommands.add(plugin.id());
5✔
91
    ProcessResult result = runTool(pc, ProcessMode.DEFAULT_CAPTURE, extensionsCommands);
6✔
92
    if (result.isSuccessful()) {
3!
93
      IdeLogLevel.SUCCESS.log(LOG, "Successfully installed plugin: {}", plugin.name());
11✔
94
      step.success();
2✔
95
      return true;
2✔
96
    }
97
    if (EDITION_VSCODIUM.equals(getConfiguredEdition())) {
×
98
      this.vscodiumUnavailablePlugins.add(plugin.id());
×
99
      return false;
×
100
    }
101
    LOG.warn("An error occurred while installing plugin: {}", plugin.name());
×
102
    return false;
×
103
  }
104

105
  @Override
106
  protected void configureToolArgs(ProcessContext pc, ProcessMode processMode, List<String> args) {
107

108
    Path vsCodeConf = this.context.getWorkspacePath().resolve(".vscode/.userdata");
6✔
109
    pc.addArg("--new-window");
4✔
110
    pc.addArg("--user-data-dir=" + vsCodeConf);
6✔
111
    Path vsCodeExtensionFolder = this.context.getIdeHome().resolve("plugins/vscode");
6✔
112
    pc.addArg("--extensions-dir=" + vsCodeExtensionFolder);
6✔
113
    pc.addArg(this.context.getWorkspacePath());
6✔
114
    super.configureToolArgs(pc, processMode, args);
5✔
115
  }
1✔
116

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