File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/integrations/claude-code Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,15 @@ import * as vscode from "vscode"
22import Anthropic from "@anthropic-ai/sdk"
33import { execa } from "execa"
44
5- const cwd = vscode . workspace . workspaceFolders ?. map ( ( folder ) => folder . uri . fsPath ) . at ( 0 )
5+ // Safely get the workspace folder, handling test environments
6+ const getCwd = ( ) => {
7+ try {
8+ return vscode . workspace . workspaceFolders ?. map ( ( folder ) => folder . uri . fsPath ) . at ( 0 )
9+ } catch {
10+ // In test environments, vscode.workspace might not be available
11+ return undefined
12+ }
13+ }
614
715export function runClaudeCode ( {
816 systemPrompt,
@@ -40,6 +48,6 @@ export function runClaudeCode({
4048 stdout : "pipe" ,
4149 stderr : "pipe" ,
4250 env : process . env ,
43- cwd,
51+ cwd : getCwd ( ) ,
4452 } )
4553}
You can’t perform that action at this time.
0 commit comments