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

devonfw / IDEasy / 27561107228

15 Jun 2026 04:34PM UTC coverage: 71.14% (+0.04%) from 71.102%
27561107228

Pull #2017

github

web-flow
Merge d5cd7e3d7 into d2a3ad5c3
Pull Request #2017: #1966: Support separate VSCodium plugins folder

4538 of 7072 branches covered (64.17%)

Branch coverage included in aggregate %.

11785 of 15873 relevant lines covered (74.25%)

3.15 hits per line

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

86.11
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.Collection;
7
import java.util.List;
8
import java.util.Set;
9

10
import org.slf4j.Logger;
11
import org.slf4j.LoggerFactory;
12

13
import com.devonfw.tools.ide.common.Tag;
14
import com.devonfw.tools.ide.context.IdeContext;
15
import com.devonfw.tools.ide.io.IdeProgressBar;
16
import com.devonfw.tools.ide.log.IdeLogLevel;
17
import com.devonfw.tools.ide.process.ProcessContext;
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
  /**
36
   * The constructor.
37
   *
38
   * @param context the {@link IdeContext}.
39
   */
40
  public Vscode(IdeContext context) {
41

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

45
  @Override
46
  protected String getBinaryName() {
47

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

54
  @Override
55
  protected Path getPluginsConfigPath() {
56

57
    if (EDITION_VSCODIUM.equals(getConfiguredEdition())) {
5✔
58
      Path vscodiumPluginsPath = this.context.getSettingsPath().resolve(EDITION_VSCODIUM).resolve(IdeContext.FOLDER_PLUGINS);
8✔
59
      if (Files.isDirectory(vscodiumPluginsPath)) {
5✔
60
        return vscodiumPluginsPath;
2✔
61
      }
62
    }
63
    return super.getPluginsConfigPath();
3✔
64
  }
65

66
  @Override
67
  protected void installPlugins(Collection<ToolPluginDescriptor> plugins, ProcessContext pc) {
68

69
    this.context.runWithoutLogging(() -> {
7✔
70
      IdeProgressBar pb = this.context.newProgressBarForPlugins(plugins.size());
7✔
71
      pc.setOutputListener((msg, err) -> {
4✔
72
        if (msg.contains("Installing extension ")) {
4!
73
          pb.stepBy(1);
×
74
        }
75
      });
1✔
76
      super.installPlugins(plugins, pc);
4✔
77
      pb.close();
2✔
78
    });
1✔
79
  }
1✔
80

81
  @Override
82
  public boolean installPlugin(ToolPluginDescriptor plugin, Step step, ProcessContext pc) {
83

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

112
  @Override
113
  protected void configureToolArgs(ProcessContext pc, ProcessMode processMode, List<String> args) {
114

115
    if (this.context.getSystemInfo().isWsl()) {
5✔
116
      pc.withEnvVar("DONT_PROMPT_WSL_INSTALL", "1");
5✔
117
    }
118
    Path vsCodeConf = this.context.getWorkspacePath().resolve(".vscode/.userdata");
6✔
119
    pc.addArg("--new-window");
4✔
120
    pc.addArg("--user-data-dir=" + vsCodeConf);
6✔
121
    Path vsCodeExtensionFolder = this.context.getIdeHome().resolve("plugins/vscode");
6✔
122
    pc.addArg("--extensions-dir=" + vsCodeExtensionFolder);
6✔
123
    pc.addArg(this.context.getWorkspacePath());
6✔
124
    super.configureToolArgs(pc, processMode, args);
5✔
125
  }
1✔
126

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