diff --git a/src/integrations/misc/open-file.ts b/src/integrations/misc/open-file.ts index 5698e919de..b3724068b6 100644 --- a/src/integrations/misc/open-file.ts +++ b/src/integrations/misc/open-file.ts @@ -29,12 +29,14 @@ export async function openFile(filePath: string, options: OpenFileOptions = {}) try { // Get workspace root const workspaceRoot = getWorkspacePath() - if (!workspaceRoot) { - throw new Error("No workspace root found") - } - // If path starts with ./, resolve it relative to workspace root - const fullPath = filePath.startsWith("./") ? path.join(workspaceRoot, filePath.slice(2)) : filePath + // If path starts with ./, resolve it relative to workspace root if available + // Otherwise, use the path as provided without modification + const fullPath = filePath.startsWith("./") + ? workspaceRoot + ? path.join(workspaceRoot, filePath.slice(2)) + : filePath + : filePath const uri = vscode.Uri.file(fullPath)