Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/services/customAgentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ export class CustomAgentService implements AgentService {

private async setupWorkingDirectory(): Promise<void> {
try {
// Try to get workspace root first
const workspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
// Try to get workspace root first from the active text editor
let workspaceRoot = vscode.window.activeTextEditor ? vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri)?.uri.fsPath : undefined;

if (!workspaceRoot) {
workspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
}

this.outputChannel.appendLine(`Workspace root detected: ${workspaceRoot}`);

if (workspaceRoot) {
Expand All @@ -50,7 +55,7 @@ export class CustomAgentService implements AgentService {
this.outputChannel.appendLine(`.superdesign directory already exists: ${superdesignDir}`);
}

this.workingDirectory = superdesignDir;
this.workingDirectory = workspaceRoot;
this.outputChannel.appendLine(`Working directory set to: ${this.workingDirectory}`);
} else {
this.outputChannel.appendLine('No workspace root found, using fallback');
Expand Down