Conversation
The settings repositories provide the VSCode user settings template as .vscode/.userdata, which is no longer read by VSCode since devonfw#2174 moved the user-data to $IDE_HOME/.ide/vscode/«workspace»/config. The workspace merge now redirects this folder to the user-data folder, and a stale .vscode/.userdata left in the workspace is moved there or backed up.
Coverage Report for CI Build 35704748924Coverage increased (+0.03%) to 74.162%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions30 previously-covered lines in 4 files lost coverage.
Coverage Stats💛 - Coveralls |
hohwille
left a comment
There was a problem hiding this comment.
@quando632 thanks for quickly taking this up. 👍 I left some quick review feedback.
| // the settings still provide the user settings template in the legacy location inside the workspace | ||
| return Map.of(workspaceFolder.resolve(LEGACY_USER_DATA), getUserDataPath()); | ||
| } | ||
|
|
There was a problem hiding this comment.
The LEGACY_USER_DATA is a Path containing of 2 folders while your merger adoption seems to handle only the current filename.
I would rather fix this without changing DirectoryMerger by changing the 3 path arguments passed to it.
So you could simply change the visibility of this method and override it for VSCode and Intellij/IdeaBasedIdeCommandlet:
If we do not want to change the directory structure below getIdeMetadataPath(), you would need to keep the knowledge of the ".vscode" (and potentially also ".userdata") folder and navigating into that for the update/setup path. Otherwise things might remain even more simple if we just keep the old structure and only relocate from getWorkspacePath() to getIdeMetadataPath() or is that not possible with this --user-data-dir option and we still have other bugs?
There was a problem hiding this comment.
Good point to double-check. The nested path is handled: DirectoryMerger looks up the full target path on every level, so «workspace»/.vscode stays as is and only «workspace»/.vscode/.userdata is redirected. VscodeTest.testConfigureWorkspaceMergesUserDataTemplateIntoUserDataFolder covers this (verified locally: without the redirect it fails).
The reason for the redirect is that one template folder has to end up in two places. ide-settings ships both .vscode/settings.json, which VSCode reads from the workspace, and .vscode/.userdata/User/settings.json, which has to go to --user-data-dir. Relocating everything to getIdeMetadataPath() would break the workspace settings. Only adjusting the paths passed to the merger would mean walking the template folders manually to leave .userdata out. The existing merge signature stays unchanged.
For IntelliJ, idea.properties and .intellij/config are still written to and read from the workspace consistently, so nothing is broken there.
…s-merge' into feature/2509-vscode-user-settings-merge
This PR fixes #2509
Since #2174 VSCode is started with
--user-data-dir=$IDE_HOME/.ide/vscode/«workspace»/config, but the settings repositories still provide the user settings template asvscode/workspace/*/.vscode/.userdata/User/settings.json. The workspace merge kept writing it to«workspace»/.vscode/.userdata, which VSCode no longer reads. As a result, the user settings were silently ignored (e.g. telemetry was on again andupdate.mode: nonewas not applied), and.vscode/.userdatawas recreated in every workspace.Implemented changes:
IdeToolCommandlet: new hookgetWorkspaceRedirects(Path)so an IDE can merge template sub-folders to a different location than the workspace. The default redirects nothing.DirectoryMerger: newmerge(..., Map<Path, Path> redirects)overload that applies these redirects while traversing the templates. The existingmergedelegates to it with an empty map.Vscode:«workspace»/.vscode/.userdatato the user-data folder passed via--user-data-dir. Existing settings repositories keep working unchanged. All other.vscodetemplates are still merged into the workspace.«workspace»/.vscode/.userdatafolder:$IDE_HOME/backups, so nothing is deleted.Mig202609002, since a migration does not run twice.VscodeTestfor the redirected merge and for both cleanup cases.Not in scope: with
VSCODE_PROFILE_ENABLEDthe user settings are still not applied (#2058, different cause).No CHANGELOG entry: the bug was introduced by #2174, which has not been released yet (2026.09.002), so per DoD it is not listed separately.
Testing instructions
vscode/workspace/update/.vscode/.userdata/User/settings.json(e.g. the default ide-settings).ide vscodein a workspace.«workspace»/.vscode/.userdatais not created.$IDE_HOME/.ide/vscode/«workspace»/config/User/settings.jsoncontains the settings from the template.telemetry.telemetryLevelisoffandupdate.modeisnone.«workspace»/.vscode/.userdatamanually and runide vscodeagain. The folder is removed from the workspace and appears under$IDE_HOME/backups/….Checklist for this PR
Make sure everything is checked before merging this PR. For further info please also see
our DoD.
mvn clean testlocally all tests pass and build is successful#«issue-id»: «brief summary»(e.g.#921: fixed setup.batand notfeature/921 fixed setup.bat). If no issue ID exists, title only.In Progressand assigned to you or there is no issue (might happen for very small PRs)with
internal(not needed: fixes an unreleased regression of VSCode: store metadata under $IDE_HOME/.ide/vscode/<workspace> + migration #2174, see DoD)pom.xmlfiles or otherwise if runtime dependencies changed, you have updated our LICENSE.asciidoc