diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 2fde56590..422593c19 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -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 diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java b/cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java index fff2ad923..7beef9d2d 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java @@ -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; @@ -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; @@ -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 vscodiumUnavailablePlugins = new ArrayList<>(); - /** * The constructor. * @@ -55,13 +52,20 @@ protected String getBinaryName() { } @Override - protected void installPlugins(Collection 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 plugins, ProcessContext pc) { + this.context.runWithoutLogging(() -> { IdeProgressBar pb = this.context.newProgressBarForPlugins(plugins.size()); pc.setOutputListener((msg, err) -> { @@ -71,16 +75,7 @@ protected void installPlugins(Collection 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 @@ -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 diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/vscode/VscodeTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/vscode/VscodeTest.java index b173869d7..ea29594f7 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/vscode/VscodeTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/vscode/VscodeTest.java @@ -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; @@ -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)}