-
Notifications
You must be signed in to change notification settings - Fork 94
#2174: store VSCode user-data under $IDE_HOME/.ide/vscode/<workspace>/config #2201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hohwille
merged 13 commits into
devonfw:main
from
quando632:feature/2174-vscode-metadata
Sep 4, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1f6a800
#2172: add getIdeMetadataPath() for $IDE_HOME/.ide/<ide>/<workspace>
quando632 caa73a5
#2142: add changelog entry for moving IDE metadata out of workspace
quando632 d2a1560
#2174: store VSCode user-data under $IDE_HOME/.ide/vscode/<workspace>…
quando632 f88f5b1
#2174: make VSCode user-data migration idempotent (skip when target e…
quando632 5e96ffa
Merge branch 'main' into feature/2174-vscode-metadata
quando632 2842074
docs: changelog
quando632 40bc0ba
Merge branch 'main' into feature/2174-vscode-metadata
quando632 2553ade
Merge branch 'main' into feature/2174-vscode-metadata
quando632 e23f8c6
Merge remote-tracking branch 'upstream/main' into feature/2174-vscode…
maybeec 71d8d2d
Merge branch 'main' into feature/2174-vscode-metadata
quando632 b432f9e
#2174: fix VscodeTest compile error and set migration version to 2026…
quando632 66cfb71
Merge branch 'main' into feature/2174-vscode-metadata
hohwille 05716f6
Merge branch 'main' into feature/2174-vscode-metadata
hohwille File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
cli/src/main/java/com/devonfw/tools/ide/migration/v2026/Mig202609002.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| package com.devonfw.tools.ide.migration.v2026; | ||
|
|
||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.util.List; | ||
|
|
||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import com.devonfw.tools.ide.context.IdeContext; | ||
| import com.devonfw.tools.ide.io.FileAccess; | ||
| import com.devonfw.tools.ide.migration.IdeVersionMigration; | ||
|
|
||
| /** | ||
| * Migration to 2026.09.002. Moves the VSCode user-data folder ({@code .vscode/.userdata}) out of each workspace into the dedicated | ||
| * {@code $IDE_HOME/.ide/vscode/«workspace»/config} folder so workspaces stay clean and independent of the IDE being used. See | ||
| * <a href="https://github.com/devonfw/IDEasy/issues/2142">#2142</a>. | ||
| */ | ||
| public class Mig202609002 extends IdeVersionMigration { | ||
|
|
||
| private static final Logger LOG = LoggerFactory.getLogger(Mig202609002.class); | ||
|
|
||
| /** | ||
| * The constructor. | ||
| */ | ||
| public Mig202609002() { | ||
|
|
||
| super("2026.09.002"); | ||
| } | ||
|
|
||
| @Override | ||
| public void run(IdeContext context) { | ||
|
|
||
| Path workspacesPath = context.getWorkspacesBasePath(); | ||
| if (workspacesPath == null) { | ||
| return; | ||
| } | ||
| FileAccess fileAccess = context.getFileAccess(); | ||
| Path vscodeMetaPath = context.getIdeHome().resolve(IdeContext.FOLDER_DOT_IDE).resolve("vscode"); | ||
| List<Path> workspaces = fileAccess.listChildren(workspacesPath, Files::isDirectory); | ||
| for (Path workspace : workspaces) { | ||
| Path oldUserData = workspace.resolve(".vscode").resolve(".userdata"); | ||
| if (fileAccess.isExpectedFolder(oldUserData)) { | ||
| Path target = vscodeMetaPath.resolve(workspace.getFileName().toString()).resolve("config"); | ||
| if (Files.exists(target)) { | ||
| LOG.warn("Skipping migration of {} since target already exists: {}", oldUserData, target); | ||
| continue; | ||
| } | ||
| fileAccess.mkdirs(target.getParent()); | ||
| fileAccess.move(oldUserData, target); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
cli/src/test/java/com/devonfw/tools/ide/migration/v2026/Mig202609002Test.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| package com.devonfw.tools.ide.migration.v2026; | ||
|
|
||
| import java.nio.file.Path; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import com.devonfw.tools.ide.context.AbstractIdeContextTest; | ||
| import com.devonfw.tools.ide.context.IdeContext; | ||
| import com.devonfw.tools.ide.context.IdeTestContext; | ||
| import com.devonfw.tools.ide.io.FileAccess; | ||
|
|
||
| /** | ||
| * Test of {@link Mig202609002}. | ||
| */ | ||
| class Mig202609002Test extends AbstractIdeContextTest { | ||
|
|
||
| /** | ||
| * Tests that an existing {@code .vscode/.userdata} folder is moved out of the workspace into {@code $IDE_HOME/.ide/vscode/«workspace»/config}. | ||
| */ | ||
| @Test | ||
| void testMovesVscodeUserDataOutOfWorkspace() { | ||
|
|
||
| // arrange | ||
| IdeTestContext context = newContext("vscode"); | ||
| FileAccess fileAccess = context.getFileAccess(); | ||
| Path workspace = context.getWorkspacePath(); | ||
| Path oldUserData = workspace.resolve(".vscode").resolve(".userdata"); | ||
| fileAccess.mkdirs(oldUserData); | ||
| fileAccess.writeFileContent("dummy", oldUserData.resolve("state.json")); | ||
| // act | ||
| new Mig202609002().run(context); | ||
| // assert | ||
| Path newConfig = context.getIdeHome().resolve(IdeContext.FOLDER_DOT_IDE).resolve("vscode").resolve(context.getWorkspaceName()).resolve("config"); | ||
| assertThat(newConfig.resolve("state.json")).exists().hasContent("dummy"); | ||
| assertThat(oldUserData).doesNotExist(); | ||
| } | ||
|
|
||
| /** | ||
| * Tests that the migration is a no-op (and does not fail) when no {@code .vscode/.userdata} folder exists. | ||
| */ | ||
| @Test | ||
| void testDoesNothingWhenNoUserData() { | ||
|
|
||
| // arrange | ||
| IdeTestContext context = newContext("vscode"); | ||
| Path vscodeMeta = context.getIdeHome().resolve(IdeContext.FOLDER_DOT_IDE).resolve("vscode"); | ||
| // act | ||
| new Mig202609002().run(context); | ||
| // assert | ||
| assertThat(vscodeMeta).doesNotExist(); | ||
| } | ||
|
|
||
| /** | ||
| * Tests that the migration skips a workspace whose target folder already exists, without failing and without overwriting the existing data. | ||
| */ | ||
| @Test | ||
| void testSkipsWhenTargetAlreadyExists() { | ||
|
|
||
| // arrange | ||
| IdeTestContext context = newContext("vscode"); | ||
| FileAccess fileAccess = context.getFileAccess(); | ||
| Path oldUserData = context.getWorkspacePath().resolve(".vscode").resolve(".userdata"); | ||
| fileAccess.mkdirs(oldUserData); | ||
| fileAccess.writeFileContent("old", oldUserData.resolve("state.json")); | ||
| Path target = context.getIdeHome().resolve(IdeContext.FOLDER_DOT_IDE).resolve("vscode").resolve(context.getWorkspaceName()).resolve("config"); | ||
| fileAccess.mkdirs(target); | ||
| fileAccess.writeFileContent("new", target.resolve("state.json")); | ||
| // act | ||
| new Mig202609002().run(context); | ||
| // assert | ||
| assertThat(oldUserData).exists(); | ||
| assertThat(target.resolve("state.json")).exists().hasContent("new"); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.