From 7780957fed7374e086b9ac9b78a4d73687fceefe Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Mon, 17 Mar 2025 15:32:26 -0400 Subject: [PATCH] Fix language passing --- src/core/Cline.ts | 3 ++- src/core/prompts/system.ts | 5 ++++- src/core/webview/ClineProvider.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 46dd640722..75f239e441 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -3692,12 +3692,13 @@ export class Cline extends EventEmitter { customModePrompts, experiments = {} as Record, customInstructions: globalCustomInstructions, + language, } = (await this.providerRef.deref()?.getState()) ?? {} const currentMode = mode ?? defaultModeSlug const modeDetails = await getFullModeDetails(currentMode, customModes, customModePrompts, { cwd, globalCustomInstructions, - language: formatLanguage(vscode.env.language), + language: language ?? formatLanguage(vscode.env.language), }) details += `\n\n# Current Mode\n` details += `${currentMode}\n` diff --git a/src/core/prompts/system.ts b/src/core/prompts/system.ts index 5285f8152e..db06980175 100644 --- a/src/core/prompts/system.ts +++ b/src/core/prompts/system.ts @@ -41,6 +41,7 @@ async function generatePrompt( diffEnabled?: boolean, experiments?: Record, enableMcpServerCreation?: boolean, + language?: string, rooIgnoreInstructions?: string, ): Promise { if (!context) { @@ -109,6 +110,7 @@ export const SYSTEM_PROMPT = async ( diffEnabled?: boolean, experiments?: Record, enableMcpServerCreation?: boolean, + language?: string, rooIgnoreInstructions?: string, ): Promise => { if (!context) { @@ -139,7 +141,7 @@ export const SYSTEM_PROMPT = async ( globalCustomInstructions || "", cwd, mode, - { language: formatLanguage(vscode.env.language), rooIgnoreInstructions }, + { language: language ?? formatLanguage(vscode.env.language), rooIgnoreInstructions }, ) // For file-based prompts, don't include the tool sections return `${roleDefinition} @@ -166,6 +168,7 @@ ${customInstructions}` diffEnabled, experiments, enableMcpServerCreation, + language, rooIgnoreInstructions, ) } diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 9b32bb6437..a50abca730 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -2545,7 +2545,7 @@ export class ClineProvider extends EventEmitter implements writeDelayMs: stateValues.writeDelayMs ?? 1000, terminalOutputLineLimit: stateValues.terminalOutputLineLimit ?? 500, mode: stateValues.mode ?? defaultModeSlug, - language: stateValues.language || formatLanguage(vscode.env.language), + language: stateValues.language ?? formatLanguage(vscode.env.language), mcpEnabled: stateValues.mcpEnabled ?? true, enableMcpServerCreation: stateValues.enableMcpServerCreation ?? true, alwaysApproveResubmit: stateValues.alwaysApproveResubmit ?? false,