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

devonfw / IDEasy / 26650274998

29 May 2026 04:50PM UTC coverage: 71.088% (-0.03%) from 71.114%
26650274998

push

github

web-flow
#1849: Add support for VSCodium (#1888)

Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>

4498 of 7004 branches covered (64.22%)

Branch coverage included in aggregate %.

11649 of 15710 relevant lines covered (74.15%)

3.14 hits per line

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

77.01
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 VSCodium was unable 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
      IdeLogLevel.WARNING.log(LOG,
×
77
          "{} plugin(s) could not be installed on VSCodium due to not being available on open-vsx or other errors:\n  - {}\n"
78
              + "For full plugin support, set VSCODE_EDITION=vscode to use Microsoft's distribution.\n"
79
              + "For more detailed information on why plugins failed to install, check the IDEasy logfile at {}.",
80
          this.vscodiumUnavailablePlugins.size(),
×
81
          String.join("\n  - ", this.vscodiumUnavailablePlugins),
×
82
          this.context.getIdeRoot().resolve(IdeContext.FOLDER_DOT_IDE).resolve(IdeContext.FOLDER_LOGS));
×
83
    }
84
  }
1✔
85

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

89
    List<String> extensionsCommands = new ArrayList<>();
4✔
90
    extensionsCommands.add("--force");
4✔
91
    extensionsCommands.add("--install-extension");
4✔
92
    String extensionInstallTarget = plugin.id();
3✔
93
    // If a version number was specified, add it to the extension identifier with the format "extensionId@version"
94
    boolean versionSpecified = (plugin.version() != null) && !plugin.version().isBlank();
11!
95
    if (versionSpecified) {
2✔
96
      extensionInstallTarget = extensionInstallTarget + "@" + plugin.version();
5✔
97
    }
98
    extensionsCommands.add(extensionInstallTarget);
4✔
99
    ProcessResult result = runTool(pc, ProcessMode.DEFAULT_CAPTURE, extensionsCommands);
6✔
100
    if (result.isSuccessful()) {
3!
101
      if (versionSpecified) {
2✔
102
        IdeLogLevel.SUCCESS.log(LOG, "Successfully installed plugin: {} with version: {}", plugin.name(), plugin.version());
17✔
103
      } else {
104
        IdeLogLevel.SUCCESS.log(LOG, "Successfully installed plugin: {}", plugin.name());
11✔
105
      }
106
      step.success();
2✔
107
      return true;
2✔
108
    }
109
    if (EDITION_VSCODIUM.equals(getConfiguredEdition())) {
×
110
      this.vscodiumUnavailablePlugins.add(plugin.id());
×
111
      return false;
×
112
    } else {
113
      if (versionSpecified) {
×
114
        IdeLogLevel.ERROR.log(LOG, "Failed to install plugin: {} with version: {}", plugin.name(), plugin.version());
×
115
      } else {
116
        IdeLogLevel.ERROR.log(LOG, "Failed to install plugin: {}", plugin.name());
×
117
      }
118
      return false;
×
119
    }
120
  }
121

122
  @Override
123
  protected void configureToolArgs(ProcessContext pc, ProcessMode processMode, List<String> args) {
124

125
    if (this.context.getSystemInfo().isWsl()) {
5✔
126
      pc.withEnvVar("DONT_PROMPT_WSL_INSTALL", "1");
5✔
127
    }
128
    Path vsCodeConf = this.context.getWorkspacePath().resolve(".vscode/.userdata");
6✔
129
    pc.addArg("--new-window");
4✔
130
    pc.addArg("--user-data-dir=" + vsCodeConf);
6✔
131
    Path vsCodeExtensionFolder = this.context.getIdeHome().resolve("plugins/vscode");
6✔
132
    pc.addArg("--extensions-dir=" + vsCodeExtensionFolder);
6✔
133
    pc.addArg(this.context.getWorkspacePath());
6✔
134
    super.configureToolArgs(pc, processMode, args);
5✔
135
  }
1✔
136

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