Skip to content

Commit 10206b9

Browse files
committed
Fix #27: support Visual Studio Code 1.118 shared storage location
Root cause was pointed out by @fuljo in the issue comments.
1 parent 8574cf5 commit 10206b9

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ For more detailed technical information about the project's architecture and com
109109

110110
## Changelog
111111

112+
### 1.27.0.0
113+
- Support: Added support for Visual Studio Code 1.118+ shared storage location (`.vscode-shared`) to ensure compatibility with recent recent folders/files storage changes.
114+
112115
### 1.26.0.0
113116
- Performance: Implement ListItem caching and optimize workspace lookup for faster loading.
114117
- Search: Cache filtered results between fallback items to improve UI responsiveness during search.

WorkspaceLauncherForVSCode/Workspaces/Readers/VscdbWorkspaceReader.cs

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public static async Task<IEnumerable<VisualStudioCodeWorkspace>> GetWorkspacesAs
2727
using var logger = new TimeLogger();
2828
#endif
2929
var workspaces = new List<VisualStudioCodeWorkspace>();
30-
var dbPath = Path.Combine(instance.StoragePath, "state.vscdb");
30+
var dbPath = GetDatabasePath(instance);
3131

32-
if (!File.Exists(dbPath))
32+
if (string.IsNullOrEmpty(dbPath) || !File.Exists(dbPath))
3333
{
3434
return workspaces;
3535
}
@@ -113,12 +113,12 @@ public static async Task<int> RemoveWorkspaceAsync(VisualStudioCodeWorkspace wor
113113
{
114114
try
115115
{
116-
if (workspace.VSCodeInstance?.StoragePath is null)
116+
if (workspace.VSCodeInstance is null)
117117
{
118118
return 0;
119119
}
120-
var dbPath = Path.Combine(workspace.VSCodeInstance.StoragePath, "state.vscdb");
121-
if (!File.Exists(dbPath)) return 0;
120+
var dbPath = GetDatabasePath(workspace.VSCodeInstance);
121+
if (string.IsNullOrEmpty(dbPath) || !File.Exists(dbPath)) return 0;
122122

123123
await using var connection = new SqliteConnection($"Data Source={dbPath};");
124124
await connection.OpenAsync();
@@ -160,5 +160,30 @@ public static async Task<int> RemoveWorkspaceAsync(VisualStudioCodeWorkspace wor
160160
return 0;
161161
}
162162
}
163+
164+
private static string GetDatabasePath(VisualStudioCodeInstance instance)
165+
{
166+
if (instance?.StoragePath == null) return string.Empty;
167+
168+
var userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
169+
string? sharedFolder = instance.VisualStudioCodeType switch
170+
{
171+
VisualStudioCodeType.Default => ".vscode-shared",
172+
VisualStudioCodeType.Insider => ".vscode-insiders-shared",
173+
_ => null
174+
};
175+
176+
if (sharedFolder != null)
177+
{
178+
var sharedDbPath = Path.Combine(userProfile, sharedFolder, "sharedStorage", "state.vscdb");
179+
if (File.Exists(sharedDbPath))
180+
{
181+
return sharedDbPath;
182+
}
183+
}
184+
185+
// Fallback to legacy path
186+
return Path.Combine(instance.StoragePath, "state.vscdb");
187+
}
163188
}
164189
}

0 commit comments

Comments
 (0)