Skip to content

Commit

Permalink
correct workspace path for mutiroot scenarios no-config debugging (#602
Browse files Browse the repository at this point in the history
…) (#607)

* correct workspace path for mutiroot scenarios no-config debugging

* rename
  • Loading branch information
eleanorjboyd authored Feb 11, 2025
1 parent 83e476d commit 7911ada
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/extension/noConfigDebugInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ export async function registerNoConfigDebug(

// create a temp directory for the noConfigDebugAdapterEndpoints
// file path format: extPath/.noConfigDebugAdapterEndpoints/endpoint-stableWorkspaceHash.txt
const workspaceUri = workspace.workspaceFolders?.[0]?.uri;
if (!workspaceUri) {
let workspaceString = workspace.workspaceFile?.fsPath;
if (!workspaceString) {
workspaceString = workspace.workspaceFolders?.map((e) => e.uri.fsPath).join(';');
}
if (!workspaceString) {
traceError('No workspace folder found');
return Promise.resolve(new Disposable(() => {}));
}

// create a stable hash for the workspace folder, reduce terminal variable churn
const hash = crypto.createHash('sha256');
hash.update(workspaceUri.toString());
hash.update(workspaceString.toString());
const stableWorkspaceHash = hash.digest('hex').slice(0, 16);

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

0 comments on commit 7911ada

Please sign in to comment.