diff --git a/src/core/Cline.ts b/src/core/Cline.ts index e98be5e..fa89a69 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -97,7 +97,6 @@ export class Cline { apiConfiguration: ApiConfiguration, customInstructions?: string, diffEnabled?: boolean, - debugDiffEnabled?: boolean, task?: string, images?: string[], historyItem?: HistoryItem, @@ -110,7 +109,7 @@ export class Cline { this.diffViewProvider = new DiffViewProvider(cwd) this.customInstructions = customInstructions if (diffEnabled && this.api.getModel().id) { - this.diffStrategy = getDiffStrategy(this.api.getModel().id, debugDiffEnabled) + this.diffStrategy = getDiffStrategy(this.api.getModel().id) } if (historyItem) { this.taskId = historyItem.id diff --git a/src/core/__tests__/Cline.test.ts b/src/core/__tests__/Cline.test.ts index 041298f..8365c61 100644 --- a/src/core/__tests__/Cline.test.ts +++ b/src/core/__tests__/Cline.test.ts @@ -279,8 +279,9 @@ describe('Cline', () => { mockApiConfig, 'custom instructions', false, // diffEnabled - false, // debugDiffEnabled - 'test task' + 'test task', // task + undefined, // images + undefined // historyItem ); expect(cline.customInstructions).toBe('custom instructions'); diff --git a/src/core/diff/DiffStrategy.ts b/src/core/diff/DiffStrategy.ts index c35ea83..355424e 100644 --- a/src/core/diff/DiffStrategy.ts +++ b/src/core/diff/DiffStrategy.ts @@ -6,10 +6,10 @@ import { SearchReplaceDiffStrategy } from './strategies/search-replace' * @param model The name of the model being used (e.g., 'gpt-4', 'claude-3-opus') * @returns The appropriate diff strategy for the model */ -export function getDiffStrategy(model: string, debugEnabled?: boolean): DiffStrategy { +export function getDiffStrategy(model: string): DiffStrategy { // For now, return SearchReplaceDiffStrategy for all models (with a fuzzy threshold of 0.9) // This architecture allows for future optimizations based on model capabilities - return new SearchReplaceDiffStrategy(0.9, debugEnabled) + return new SearchReplaceDiffStrategy(0.9) } export type { DiffStrategy } diff --git a/src/core/diff/strategies/search-replace.ts b/src/core/diff/strategies/search-replace.ts index 9153c4e..87b6145 100644 --- a/src/core/diff/strategies/search-replace.ts +++ b/src/core/diff/strategies/search-replace.ts @@ -55,12 +55,10 @@ function getSimilarity(original: string, search: string): number { export class SearchReplaceDiffStrategy implements DiffStrategy { private fuzzyThreshold: number; - public debugEnabled: boolean; - constructor(fuzzyThreshold?: number, debugEnabled?: boolean) { + constructor(fuzzyThreshold?: number) { // Default to exact matching (1.0) unless fuzzy threshold specified this.fuzzyThreshold = fuzzyThreshold ?? 1.0; - this.debugEnabled = debugEnabled ?? false; } getToolDescription(cwd: string): string { @@ -177,11 +175,9 @@ Result: // Extract the search and replace blocks const match = diffContent.match(/<<<<<<< SEARCH\n([\s\S]*?)\n?=======\n([\s\S]*?)\n?>>>>>>> REPLACE/); if (!match) { - const debugInfo = this.debugEnabled ? `\n\nDebug Info:\n- Expected Format: <<<<<<< SEARCH\\n[search content]\\n=======\\n[replace content]\\n>>>>>>> REPLACE\n- Tip: Make sure to include both SEARCH and REPLACE sections with correct markers` : ''; - return { success: false, - error: `Invalid diff format - missing required SEARCH/REPLACE sections${debugInfo}` + error: `Invalid diff format - missing required SEARCH/REPLACE sections\n\nDebug Info:\n- Expected Format: <<<<<<< SEARCH\\n[search content]\\n=======\\n[replace content]\\n>>>>>>> REPLACE\n- Tip: Make sure to include both SEARCH and REPLACE sections with correct markers` }; } @@ -221,17 +217,9 @@ Result: const exactEndIndex = endLine - 1; if (exactStartIndex < 0 || exactEndIndex > originalLines.length || exactStartIndex > exactEndIndex) { - const debugInfo = this.debugEnabled ? `\n\nDebug Info:\n- Requested Range: lines ${startLine}-${endLine}\n- File Bounds: lines 1-${originalLines.length}` : ''; - - // Log detailed debug information - console.log('Invalid Line Range Debug:', { - requestedRange: { start: startLine, end: endLine }, - fileBounds: { start: 1, end: originalLines.length } - }); - return { success: false, - error: `Line range ${startLine}-${endLine} is invalid (file has ${originalLines.length} lines)${debugInfo}`, + error: `Line range ${startLine}-${endLine} is invalid (file has ${originalLines.length} lines)\n\nDebug Info:\n- Requested Range: lines ${startLine}-${endLine}\n- File Bounds: lines 1-${originalLines.length}`, }; } @@ -294,13 +282,11 @@ Result: ? `\n\nBest Match Found:\n${addLineNumbers(bestMatchContent, matchIndex + 1)}` : `\n\nBest Match Found:\n(no match)`; - const debugInfo = this.debugEnabled ? `\n\nDebug Info:\n- Similarity Score: ${Math.floor(bestMatchScore * 100)}%\n- Required Threshold: ${Math.floor(this.fuzzyThreshold * 100)}%\n- Search Range: ${startLine && endLine ? `lines ${startLine}-${endLine}` : 'start to end'}\n\nSearch Content:\n${searchChunk}${bestMatchSection}${originalContentSection}` : ''; - const lineRange = startLine || endLine ? ` at ${startLine ? `start: ${startLine}` : 'start'} to ${endLine ? `end: ${endLine}` : 'end'}` : ''; return { success: false, - error: `No sufficiently similar match found${lineRange} (${Math.floor(bestMatchScore * 100)}% similar, needs ${Math.floor(this.fuzzyThreshold * 100)}%)${debugInfo}` + error: `No sufficiently similar match found${lineRange} (${Math.floor(bestMatchScore * 100)}% similar, needs ${Math.floor(this.fuzzyThreshold * 100)}%)\n\nDebug Info:\n- Similarity Score: ${Math.floor(bestMatchScore * 100)}%\n- Required Threshold: ${Math.floor(this.fuzzyThreshold * 100)}%\n- Search Range: ${startLine && endLine ? `lines ${startLine}-${endLine}` : 'start to end'}\n\nSearch Content:\n${searchChunk}${bestMatchSection}${originalContentSection}` }; } diff --git a/src/core/diff/types.ts b/src/core/diff/types.ts index a662c47..3957a1f 100644 --- a/src/core/diff/types.ts +++ b/src/core/diff/types.ts @@ -13,11 +13,6 @@ export type DiffResult = }}; export interface DiffStrategy { - /** - * Whether to enable detailed debug logging - */ - debugEnabled?: boolean; - /** * Get the tool description for this diff strategy * @param cwd The current working directory diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 861046e..f4d9e5b 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -68,7 +68,6 @@ type GlobalStateKey = | "soundEnabled" | "soundVolume" | "diffEnabled" - | "debugDiffEnabled" | "alwaysAllowMcp" export const GlobalFileNames = { @@ -217,8 +216,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { const { apiConfiguration, customInstructions, - diffEnabled, - debugDiffEnabled, + diffEnabled } = await this.getState() this.cline = new Cline( @@ -226,7 +224,6 @@ export class ClineProvider implements vscode.WebviewViewProvider { apiConfiguration, customInstructions, diffEnabled, - debugDiffEnabled, task, images ) @@ -237,8 +234,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { const { apiConfiguration, customInstructions, - diffEnabled, - debugDiffEnabled, + diffEnabled } = await this.getState() this.cline = new Cline( @@ -246,10 +242,9 @@ export class ClineProvider implements vscode.WebviewViewProvider { apiConfiguration, customInstructions, diffEnabled, - debugDiffEnabled, undefined, undefined, - historyItem, + historyItem ) } @@ -614,11 +609,6 @@ export class ClineProvider implements vscode.WebviewViewProvider { await this.updateGlobalState("diffEnabled", diffEnabled) await this.postStateToWebview() break - case "debugDiffEnabled": - const debugDiffEnabled = message.bool ?? false - await this.updateGlobalState("debugDiffEnabled", debugDiffEnabled) - await this.postStateToWebview() - break } }, null, @@ -945,7 +935,6 @@ export class ClineProvider implements vscode.WebviewViewProvider { alwaysAllowMcp, soundEnabled, diffEnabled, - debugDiffEnabled, taskHistory, soundVolume, } = await this.getState() @@ -970,7 +959,6 @@ export class ClineProvider implements vscode.WebviewViewProvider { .sort((a, b) => b.ts - a.ts), soundEnabled: soundEnabled ?? false, diffEnabled: diffEnabled ?? false, - debugDiffEnabled: debugDiffEnabled ?? false, shouldShowAnnouncement: lastShownAnnouncementId !== this.latestAnnouncementId, allowedCommands, soundVolume: soundVolume ?? 0.5, @@ -1066,7 +1054,6 @@ export class ClineProvider implements vscode.WebviewViewProvider { allowedCommands, soundEnabled, diffEnabled, - debugDiffEnabled, soundVolume, ] = await Promise.all([ this.getGlobalState("apiProvider") as Promise, @@ -1105,7 +1092,6 @@ export class ClineProvider implements vscode.WebviewViewProvider { this.getGlobalState("allowedCommands") as Promise, this.getGlobalState("soundEnabled") as Promise, this.getGlobalState("diffEnabled") as Promise, - this.getGlobalState("debugDiffEnabled") as Promise, this.getGlobalState("soundVolume") as Promise, ]) @@ -1162,7 +1148,6 @@ export class ClineProvider implements vscode.WebviewViewProvider { allowedCommands, soundEnabled: soundEnabled ?? false, diffEnabled: diffEnabled ?? false, - debugDiffEnabled: debugDiffEnabled ?? false, soundVolume, } } diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index e95bb80..07a3dde 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -53,7 +53,6 @@ export interface ExtensionState { soundEnabled?: boolean soundVolume?: number diffEnabled?: boolean - debugDiffEnabled?: boolean } export interface ClineMessage { diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index aca93e1..2864a94 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -34,7 +34,6 @@ export interface WebviewMessage { | "soundEnabled" | "soundVolume" | "diffEnabled" - | "debugDiffEnabled" | "openMcpSettings" | "restartMcpServer" | "toggleToolAlwaysAllow" diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index e1c9701..817c3b4 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -33,8 +33,6 @@ const SettingsView = ({ onDone }: SettingsViewProps) => { setSoundVolume, diffEnabled, setDiffEnabled, - debugDiffEnabled, - setDebugDiffEnabled, openRouterModels, setAllowedCommands, allowedCommands, @@ -64,7 +62,6 @@ const SettingsView = ({ onDone }: SettingsViewProps) => { vscode.postMessage({ type: "soundEnabled", bool: soundEnabled }) vscode.postMessage({ type: "soundVolume", value: soundVolume }) vscode.postMessage({ type: "diffEnabled", bool: diffEnabled }) - vscode.postMessage({ type: "debugDiffEnabled", bool: debugDiffEnabled }) onDone() } } @@ -358,20 +355,6 @@ const SettingsView = ({ onDone }: SettingsViewProps) => { )} - -
- setDebugDiffEnabled(e.target.checked)}> - Debug diff operations - -

- When enabled, Cline will show detailed debug information when applying diffs fails. -

-
{IS_DEV && ( diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index f4fdaa3..7b832ef 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -31,7 +31,6 @@ export interface ExtensionStateContextType extends ExtensionState { setSoundEnabled: (value: boolean) => void setSoundVolume: (value: number) => void setDiffEnabled: (value: boolean) => void - setDebugDiffEnabled: (value: boolean) => void } const ExtensionStateContext = createContext(undefined) @@ -46,7 +45,6 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode soundEnabled: false, soundVolume: 0.5, diffEnabled: false, - debugDiffEnabled: false, }) const [didHydrateState, setDidHydrateState] = useState(false) const [showWelcome, setShowWelcome] = useState(false) @@ -149,10 +147,6 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode setSoundEnabled: (value) => setState((prevState) => ({ ...prevState, soundEnabled: value })), setSoundVolume: (value) => setState((prevState) => ({ ...prevState, soundVolume: value })), setDiffEnabled: (value) => setState((prevState) => ({ ...prevState, diffEnabled: value })), - setDebugDiffEnabled: (value) => setState((prevState) => ({ - ...prevState, - debugDiffEnabled: value - })), } return {children}