Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Release with new features and bugfixes:
* https://github.com/devonfw/IDEasy/issues/1849[#1849]: Add VSCodium support
* https://github.com/devonfw/IDEasy/issues/1391[#1391]: Fix bashrc messed with terraform completions
* https://github.com/devonfw/IDEasy/issues/1922[#1922]: Add Task CLI to IDEasy commandlets
* https://github.com/devonfw/IDEasy/issues/1966[#1966]: Support separate VSCodium plugins
* https://github.com/devonfw/IDEasy/issues/1518[#1518]: Add per-project uv tool isolation using UV_TOOL_DIR and UV_TOOL_BIN_DIR
* https://github.com/devonfw/IDEasy/issues/1719[#1719]: Add Rust and MSVC support
* https://github.com/devonfw/IDEasy/issues/1991[#1991]: Improve WindowsHelperMock
Expand Down
48 changes: 19 additions & 29 deletions cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.devonfw.tools.ide.tool.vscode;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -14,7 +15,6 @@
import com.devonfw.tools.ide.io.IdeProgressBar;
import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.process.ProcessContext;
import com.devonfw.tools.ide.process.ProcessErrorHandling;
import com.devonfw.tools.ide.process.ProcessMode;
import com.devonfw.tools.ide.process.ProcessResult;
import com.devonfw.tools.ide.step.Step;
Expand All @@ -32,9 +32,6 @@ public class Vscode extends IdeToolCommandlet {
/** The {@link #getConfiguredEdition() edition} for VSCodium. */
private static final String EDITION_VSCODIUM = "vscodium";

/** Plugin IDs collected during {@link #installPlugins} that VSCodium was unable to install. */
private final List<String> vscodiumUnavailablePlugins = new ArrayList<>();

/**
* The constructor.
*
Expand All @@ -55,13 +52,20 @@ protected String getBinaryName() {
}

@Override
protected void installPlugins(Collection<ToolPluginDescriptor> plugins, ProcessContext pc) {
boolean isVscodium = EDITION_VSCODIUM.equals(getConfiguredEdition());
if (isVscodium) {
this.vscodiumUnavailablePlugins.clear();
pc.errorHandling(ProcessErrorHandling.NONE);
protected Path getPluginsConfigPath() {

if (EDITION_VSCODIUM.equals(getConfiguredEdition())) {
Path vscodiumPluginsPath = this.context.getSettingsPath().resolve(EDITION_VSCODIUM).resolve(IdeContext.FOLDER_PLUGINS);
if (Files.isDirectory(vscodiumPluginsPath)) {
return vscodiumPluginsPath;
}
}
IdeLogLevel suppressLevel = isVscodium ? IdeLogLevel.WARNING : IdeLogLevel.STEP;
return super.getPluginsConfigPath();
}

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

this.context.runWithoutLogging(() -> {
IdeProgressBar pb = this.context.newProgressBarForPlugins(plugins.size());
pc.setOutputListener((msg, err) -> {
Expand All @@ -71,16 +75,7 @@ protected void installPlugins(Collection<ToolPluginDescriptor> plugins, ProcessC
});
super.installPlugins(plugins, pc);
pb.close();
}, suppressLevel);
if (isVscodium && !this.vscodiumUnavailablePlugins.isEmpty()) {
IdeLogLevel.WARNING.log(LOG,
"{} plugin(s) could not be installed on VSCodium due to not being available on open-vsx or other errors:\n - {}\n"
+ "For full plugin support, set VSCODE_EDITION=vscode to use Microsoft's distribution.\n"
+ "For more detailed information on why plugins failed to install, check the IDEasy logfile at {}.",
this.vscodiumUnavailablePlugins.size(),
String.join("\n - ", this.vscodiumUnavailablePlugins),
this.context.getIdeRoot().resolve(IdeContext.FOLDER_DOT_IDE).resolve(IdeContext.FOLDER_LOGS));
}
});
}

@Override
Expand All @@ -106,17 +101,12 @@ public boolean installPlugin(ToolPluginDescriptor plugin, Step step, ProcessCont
step.success();
return true;
}
if (EDITION_VSCODIUM.equals(getConfiguredEdition())) {
this.vscodiumUnavailablePlugins.add(plugin.id());
return false;
if (versionSpecified) {
IdeLogLevel.ERROR.log(LOG, "Failed to install plugin: {} with version: {}", plugin.name(), plugin.version());
} else {
if (versionSpecified) {
IdeLogLevel.ERROR.log(LOG, "Failed to install plugin: {} with version: {}", plugin.name(), plugin.version());
} else {
IdeLogLevel.ERROR.log(LOG, "Failed to install plugin: {}", plugin.name());
}
return false;
IdeLogLevel.ERROR.log(LOG, "Failed to install plugin: {}", plugin.name());
}
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.devonfw.tools.ide.tool.vscode;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -175,6 +176,36 @@ void testVscodiumRun() {
checkVscodiumInstallation(context);
}

/**
* Tests that VSCodium reads its plugins from the dedicated vscodium folder when it exists.
*/
@Test
void testVscodiumUsesVscodiumPluginsFolder() {

// arrange
IdeTestContext context = newContext(PROJECT_VSCODIUM);
Vscode vscodium = new Vscode(context);
Path vscodiumPlugins = context.getSettingsPath().resolve("vscodium/plugins");
context.getFileAccess().mkdirs(vscodiumPlugins);

// act + assert
assertThat(vscodium.getPluginsConfigPath()).isEqualTo(vscodiumPlugins);
}

/**
* Tests that VSCodium falls back to the vscode folder when it has no dedicated plugins folder.
*/
@Test
void testVscodiumFallsBackToVscodePluginsFolder() {

// arrange
IdeTestContext context = newContext(PROJECT_VSCODIUM);
Vscode vscodium = new Vscode(context);

// act + assert
assertThat(vscodium.getPluginsConfigPath()).isEqualTo(context.getSettingsPath().resolve("vscode/plugins"));
}


/**
* Test double for {@link Vscode} that captures CLI arguments passed to {@link #runTool(ProcessContext, ProcessMode, List)}
Expand Down
Loading