Skip to content

#2471: install VSCode plugins after the IDE has created the profile - #2479

Open
quando632 wants to merge 5 commits into
devonfw:mainfrom
quando632:fix/2471-vscode-profile-not-found
Open

quando632 wants to merge 5 commits into
devonfw:mainfrom
quando632:fix/2471-vscode-profile-not-found

Conversation

@quando632

@quando632 quando632 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #2471

Implemented changes:

  • Vscode no longer installs the plugins before VS Code has created its profile.

VS Code only creates a named profile when it opens a window. From code --help:

--profile <profileName> Opens the provided folder or workspace with the given profile […] If the profile does not exist, a new empty one is created.

As soon as --install-extension (or --list-extensions / --uninstall-extension) is passed, VS Code takes the extension management code path instead: the folder argument is ignored, no window is opened, and the profile is only looked up. If it does not exist, VS Code aborts with Profile '<name>' not found. and exit code 1.

Since the plugins are installed from postInstall(), i.e. before VS Code is ever launched, every plugin installation failed on a fresh profile while VSCODE_PROFILE_ENABLED=true.

installPlugins(...) now checks whether the profile already exists. If it does not, the plugins are deferred and installed after the IDE has been launched, once the profile shows up (checked once per second for at most 20 s, with an info message while IDEasy waits). The profile is only considered missing if VS Code names it on stderr (Profile '<name>' not found.). Any other failure of VS Code is reported with its output instead: before the launch the plugins are installed as usual so the real error surfaces, after the launch the wait stops immediately. If the profile already exists, every run after the first, so the established order is kept, so the plugins are active right away.

  • The plugins are installed into a newly created profile even if their marker files already exist.

The plugin marker files live per IDEasy project while the plugins of VSCode belong to a profile. A profile that VSCode has just created is empty, so the marker files cannot tell whether a plugin is present in it. Enabling the toggle in an existing project therefore left the user with an IDE without a single plugin: the new profile is empty, but every plugin was skipped as already installed, IDEasy reported success and asked for a window reload that changed nothing.

PluginBasedCommandlet now offers isForcePluginInstallation() as an extension point for the marker file check and reports how many plugins were installed. Vscode overrides it while installing into a profile it has just created, and only asks for the reload when something was actually installed. The default behaviour of all other IDE commandlets is unchanged.

Also corrected a code comment claiming that a profile isolates authentication. It does not: VS Code keeps auth sessions in the OS keyring and shares them across all profiles (see the analysis in #2058).


Testing instructions

Verified end to end against a real VS Code 1.137.0 on Windows 11, with VSCODE_PROFILE_ENABLED=true, a profile that did not exist yet and no plugin marker files. The observed order of code.cmd invocations was:

  1. --list-extensions — fails, profile does not exist, plugin installation is deferred
  2. launch without extension arguments — VS Code opens and creates the profile
  3. --list-extensions — still failing on the first poll
  4. --list-extensions — succeeds on the second poll
  5. --force --install-extension … for every plugin

Result: 39 of 39 plugins installed, 0 failures. Before this change the same scenario failed 39 out of 39 times with Profile '...' not found.

A second run was done with the marker files deliberately left in place, which is what a user enabling the toggle in an existing project actually has: 38 plugins installed, 0 failures, 0 skipped because of a marker file, and the freshly created profile ended up with 62 extensions. Before this change that exact scenario produced a profile with 0 extensions while IDEasy reported success.

Step 4 below was not exercised in those runs; the "profile already exists" path was only observed separately in another workspace.

  1. Automated tests:
mvn -pl cli test -Dtest=VscodeTest

Six cases are covered:

  • testPluginsAreInstalledBeforeLaunchByDefault: toggle disabled, established order unchanged
  • testPluginsAreInstalledAfterLaunchIfProfileEnabled: toggle enabled, profile missing, plugins installed after the launch
  • testPluginsAreInstalledBeforeLaunchIfProfileAlreadyExists: toggle enabled, profile present, established order kept
  • testPluginsAreInstalledIntoNewProfileDespiteExistingMarkerFiles: plugins installed into the new profile although their marker files exist
  • testPluginsAreNotDeferredIfVscodeFailsForAnotherReason: VS Code fails for another reason, plugins are not deferred and the cause is reported
  • testDeferredPluginsAreSkippedIfVscodeFailsAfterLaunch: VS Code fails after the launch, waiting stops on the first unexpected failure
  1. Reproduce the underlying VS Code behaviour without IDEasy (any VS Code, here 1.137.0):
# profile does not exist -> fails, no window is opened
code --profile=some-not-existing-name --list-extensions
# -> Profile 'some-not-existing-name' not found.   exit 1
  1. End to end with a fresh profile:

    • set VSCODE_PROFILE_ENABLED=true in $IDE_HOME/conf/ide.properties
    • make sure the profile ideasy-«project»-«workspace» does not exist yet
    • keep your existing plugin marker files under $IDE_HOME/.ide/plugin.vscode.* — this is the realistic case when enabling the toggle in an existing project
    • run ide vscode

    Expected: VS Code starts, then all active plugins are installed and a message asks for a window reload. Verify that the new profile really contains them:

code --profile=ideasy-«project»-«workspace» --extensions-dir=$IDE_HOME/plugins/vscode --list-extensions

Before this PR every plugin failed with Profile '...' not found., and with the previous commit alone the profile would have stayed empty because of the marker files.

  1. Run ide vscode a second time.

    Expected: unchanged behaviour, nothing is reinstalled, no reload message.


Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary»
  • PR top-level comment summaries what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labelled with internal
  • You have not changed any dependency in pom.xml files or otherwise if runtime dependencies changed, you have updated our LICENSE.asciidoc
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

On the two unchecked items:

  • CHANGELOG: deliberately omitted. The DoD states that a bugfix to a story that was never released does not need a CHANGELOG entry, and VSCode authentication not working with IDEasy #2058 is still behind the feature toggle and intentionally not in the CHANGELOG until the pilot succeeds.

…ofile

VS Code only creates a named profile when it opens a window. CLI calls such
as --install-extension merely look the profile up and abort with
"Profile '<name>' not found". Since the plugins were installed from
postInstall, i.e. before VS Code was ever launched, every plugin
installation failed on a fresh profile.

Vscode now checks whether the profile already exists and defers the plugin
installation until after the IDE has been launched if it does not. Once the
profile exists the established order is kept so the plugins are active right
away.

Also corrected the comment claiming that a profile isolates authentication:
VS Code keeps the auth sessions in the OS keyring and shares them across all
profiles.
@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Sep 15, 2026
@quando632 quando632 added vscode Microsoft visual studio code plugins related to plugins (for Eclipse, Intellij, VSCode, etc.) install installation process of IDE + tools and install commandlet labels Sep 15, 2026
@coveralls

coveralls commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 35725900551

Coverage increased (+0.03%) to 74.168%

Details

  • Coverage increased (+0.03%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 24 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

24 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/tool/vscode/Vscode.java 15 80.95%
com/devonfw/tools/ide/tool/plugin/PluginBasedCommandlet.java 9 88.24%

Coverage Stats

Coverage Status
Relevant Lines: 19179
Covered Lines: 14862
Line Coverage: 77.49%
Relevant Branches: 8589
Covered Branches: 5733
Branch Coverage: 66.75%
Branches in Coverage %: Yes
Coverage Strength: 3.32 hits per line

💛 - Coveralls

The plugin marker files live per IDEasy project while the plugins of VSCode
belong to a profile. A profile that VSCode has just created is empty, so the
marker files cannot tell whether a plugin is present in it.

Enabling VSCODE_PROFILE_ENABLED in an existing project therefore left the user
with an IDE without any plugin: the new profile is empty, but every plugin was
skipped as already installed. IDEasy reported success and asked for a window
reload that changed nothing.

PluginBasedCommandlet now offers isForcePluginInstallation() as an extension
point for the marker file check and reports how many plugins were installed.
Vscode overrides the extension point while installing into a profile it has
just created, and only asks for the reload when something was installed.
@quando632 quando632 moved this from 🆕 New to 🏗 In progress in IDEasy board Sep 16, 2026
@quando632 quando632 moved this from 🏗 In progress to 🆕 New in IDEasy board Sep 16, 2026
@quando632 quando632 moved this from 🆕 New to Team Review in IDEasy board Sep 16, 2026
@MeShehi

MeShehi commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR, the tests are clearly passing so no issues there. I was wondering on the choice of waiting 30 times, 1 seconds each, is there a particular reason for this choice or is it just a "hunch"? I wonder if it could be lowered or if there is an argument to increasing it. Just a curiosity/nitpick, and also asking in case there are other similar cases in IDEasy. After the changelog addition I would still move to Reviews

@laert-ll laert-ll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work. I'd also add to what @MeShehi said about the 30 second wait, I think that might be a bit too much, especially if it stays hanging with no clear message to the user.

Otherwise looks good to me :)

Comment thread cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java Outdated

// A profile that VSCode has just created is empty. Our plugin marker files live per project while the plugins of VSCode belong to a profile, so the marker
// files cannot tell whether a plugin is present in the new profile. Without this the user ends up with an empty IDE. See issue #2471.
return this.installingIntoNewProfile || super.isForcePluginInstallation();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

installingIntoNewProfile is set true whenever plugins are being installed into a freshly created profile.

Suggestion: instead of reinstalling everything, could we check the actual plugin list VS Code has and only install what's missing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea, but in this PR it would not change the outcome: the flag is only set while installing into a profile that VS Code has just created, and such a profile is empty, so every plugin is missing anyway. Checking the real extension list instead of the marker files would be more robust in general, for example when a user resets the profile or the profile creation times out while old marker files exist. However, it changes how PluginBasedCommandlet decides what is installed for all IDEs, including id matching and pinned versions. I would prefer to do that in a follow-up issue, if that is fine with you. Shall I open one?

…st 20 s

The profile check reused the process context of the plugin installation,
which throws and logs on a non-zero exit code. Every check before VSCode had
created the profile was therefore reported as an error. It also treated any
failure as a missing profile, so a broken VSCode made IDEasy poll until the
timeout.

The check now uses its own process context without error handling and only
considers the profile missing if VSCode names it on stderr. Any other failure
is reported with the output of VSCode: before the launch the plugins are
installed as usual so the real error surfaces, after the launch the wait stops
immediately.

The wait is bounded by a wall clock deadline of 20 s instead of 30 attempts,
since each attempt spawns VSCode itself, and the user is informed while
IDEasy waits.
@quando632

Copy link
Copy Markdown
Contributor Author

Thanks both for the review! @MeShehi, the 30 x 1 s was an upper bound picked by feel, not a measured value. In my end to end runs the profile showed up on the second check, roughly 2 s after launch. The count based loop could also take much longer than 30 s, since every check spawns code --list-extensions, which itself takes about a second. It is now a wall clock deadline of 20 s, and as @laert-ll suggested, the user gets an info message while IDEasy waits instead of a silent hang. There is no comparable wait loop elsewhere in IDEasy, Thread.sleep does not appear anywhere else in cli/src/main/java.

Regarding the CHANGELOG: I left it out on purpose, see the note at the end of the PR description. #2058 is still behind the VSCODE_PROFILE_ENABLED toggle and unreleased, and the DoD says a fix to an unreleased story needs no entry. Happy to add one if you see it differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

install installation process of IDE + tools and install commandlet plugins related to plugins (for Eclipse, Intellij, VSCode, etc.) vscode Microsoft visual studio code

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

VSCode plugin installation fails with "Profile '<name>' not found" when VSCODE_PROFILE_ENABLED is enabled

4 participants