diff --git a/ide/src/logging.ts b/ide/src/logging.ts index 9b4de4d0f..fc5f91ce5 100644 --- a/ide/src/logging.ts +++ b/ide/src/logging.ts @@ -6,4 +6,5 @@ export let log = (...strs: any[]) => { let s = strs.map((obj) => String(obj)).join("\t"); logs.push(s); channel.appendLine(s); + console.log(...strs); }; diff --git a/ide/src/setup.ts b/ide/src/setup.ts index 45b443dff..5ed4322d0 100644 --- a/ide/src/setup.ts +++ b/ide/src/setup.ts @@ -115,6 +115,7 @@ export let cargo_command = (): [string, string[]] => { let findWorkspaceRoot = async (): Promise => { let folders = vscode.workspace.workspaceFolders; if (!folders || folders.length === 0) { + log("No folders exist"); return null; } @@ -129,12 +130,18 @@ let findWorkspaceRoot = async (): Promise => { } }; + let folderPath = folders[0].uri.fsPath; + if (hasCargoToml(folderPath)) return folderPath; + let activeEditor = vscode.window.activeTextEditor; - if (!activeEditor) return null; + if (!activeEditor) { + log("No active editor exists"); + return null; + } - let folderPath = folders[0].uri.fsPath; let activeFilePath = activeEditor.document.fileName; log(`Looking for workspace root between ${folderPath} and ${activeFilePath}`); + let components = path.relative(folderPath, activeFilePath).split(path.sep); let folderSubdirTil = (idx: number) => path.join(folderPath, ...components.slice(0, idx));