Browse Source

Default diff editing to on for new installs

Matt Rubens 1 year ago
parent
commit
b6b5c8e422

+ 5 - 0
.changeset/ninety-stingrays-give.md

@@ -0,0 +1,5 @@
+---
+"roo-cline": patch
+---
+
+Default diff editing to on for new installs

+ 2 - 2
src/core/webview/ClineProvider.ts

@@ -972,7 +972,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
 				.filter((item) => item.ts && item.task)
 				.filter((item) => item.ts && item.task)
 				.sort((a, b) => b.ts - a.ts),
 				.sort((a, b) => b.ts - a.ts),
 			soundEnabled: soundEnabled ?? false,
 			soundEnabled: soundEnabled ?? false,
-			diffEnabled: diffEnabled ?? false,
+			diffEnabled: diffEnabled ?? true,
 			shouldShowAnnouncement: lastShownAnnouncementId !== this.latestAnnouncementId,
 			shouldShowAnnouncement: lastShownAnnouncementId !== this.latestAnnouncementId,
 			allowedCommands,
 			allowedCommands,
 			soundVolume: soundVolume ?? 0.5,
 			soundVolume: soundVolume ?? 0.5,
@@ -1166,7 +1166,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
 			taskHistory,
 			taskHistory,
 			allowedCommands,
 			allowedCommands,
 			soundEnabled: soundEnabled ?? false,
 			soundEnabled: soundEnabled ?? false,
-			diffEnabled: diffEnabled ?? false,
+			diffEnabled: diffEnabled ?? true,
 			soundVolume,
 			soundVolume,
 			browserLargeViewport: browserLargeViewport ?? false,
 			browserLargeViewport: browserLargeViewport ?? false,
 			fuzzyMatchThreshold: fuzzyMatchThreshold ?? 1.0,
 			fuzzyMatchThreshold: fuzzyMatchThreshold ?? 1.0,

+ 9 - 0
src/core/webview/__tests__/ClineProvider.test.ts

@@ -300,6 +300,15 @@ describe('ClineProvider', () => {
         expect(state).toHaveProperty('diffEnabled')
         expect(state).toHaveProperty('diffEnabled')
     })
     })
 
 
+    test('diffEnabled defaults to true when not set', async () => {
+        // Mock globalState.get to return undefined for diffEnabled
+        (mockContext.globalState.get as jest.Mock).mockReturnValue(undefined)
+        
+        const state = await provider.getState()
+        
+        expect(state.diffEnabled).toBe(true)
+    })
+
     test('updates sound utility when sound setting changes', async () => {
     test('updates sound utility when sound setting changes', async () => {
         provider.resolveWebviewView(mockWebviewView)
         provider.resolveWebviewView(mockWebviewView)