Skip to content

Commit 1bfa853

Browse files
committed
correct workspace path for mutiroot scenarios no-config debugging
1 parent 13bf88f commit 1bfa853

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/extension/noConfigDebugInit.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@ export async function registerNoConfigDebug(
3737

3838
// create a temp directory for the noConfigDebugAdapterEndpoints
3939
// file path format: extPath/.noConfigDebugAdapterEndpoints/endpoint-stableWorkspaceHash.txt
40-
const workspaceUri = workspace.workspaceFolders?.[0]?.uri;
41-
if (!workspaceUri) {
42-
traceError('No workspace folder found');
43-
return Promise.resolve(new Disposable(() => {}));
40+
let workspaceFile = workspace.workspaceFile?.fsPath;
41+
if (!workspaceFile) {
42+
workspaceFile = workspace.workspaceFolders?.[0].uri.fsPath;
43+
}
44+
if (!workspaceFile) {
45+
throw new Error('No workspace folder detected. Please open a workspace.');
4446
}
4547

4648
// create a stable hash for the workspace folder, reduce terminal variable churn
4749
const hash = crypto.createHash('sha256');
48-
hash.update(workspaceUri.toString());
50+
hash.update(workspaceFile);
4951
const stableWorkspaceHash = hash.digest('hex').slice(0, 16);
5052

5153
const tempDirPath = path.join(extPath, '.noConfigDebugAdapterEndpoints');

0 commit comments

Comments
 (0)