Checkbox to experiment with letting Cline edit through diffs (#48)

Co-authored-by: Jozi <jozigila@gmail.com>
This commit is contained in:
Matt Rubens
2024-12-07 16:35:55 -05:00
committed by GitHub
parent dafe286076
commit 5d9d36c128
15 changed files with 174 additions and 14 deletions

View File

@@ -64,6 +64,7 @@ type GlobalStateKey =
| "openRouterUseMiddleOutTransform"
| "allowedCommands"
| "soundEnabled"
| "diffEnabled"
export const GlobalFileNames = {
apiConversationHistory: "api_conversation_history.json",
@@ -201,12 +202,14 @@ export class ClineProvider implements vscode.WebviewViewProvider {
const {
apiConfiguration,
customInstructions,
diffEnabled,
} = await this.getState()
this.cline = new Cline(
this,
apiConfiguration,
customInstructions,
diffEnabled,
task,
images
)
@@ -217,12 +220,14 @@ export class ClineProvider implements vscode.WebviewViewProvider {
const {
apiConfiguration,
customInstructions,
diffEnabled,
} = await this.getState()
this.cline = new Cline(
this,
apiConfiguration,
customInstructions,
diffEnabled,
undefined,
undefined,
historyItem,
@@ -532,9 +537,13 @@ export class ClineProvider implements vscode.WebviewViewProvider {
}
break
case "soundEnabled":
const enabled = message.bool ?? true
await this.updateGlobalState("soundEnabled", enabled)
setSoundEnabled(enabled)
const soundEnabled = message.bool ?? true
await this.updateGlobalState("soundEnabled", soundEnabled)
await this.postStateToWebview()
break
case "diffEnabled":
const diffEnabled = message.bool ?? true
await this.updateGlobalState("diffEnabled", diffEnabled)
await this.postStateToWebview()
break
}
@@ -843,6 +852,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
alwaysAllowExecute,
alwaysAllowBrowser,
soundEnabled,
diffEnabled,
taskHistory,
} = await this.getState()
@@ -863,7 +873,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
taskHistory: (taskHistory || [])
.filter((item) => item.ts && item.task)
.sort((a, b) => b.ts - a.ts),
soundEnabled: soundEnabled ?? true,
soundEnabled: soundEnabled ?? false,
diffEnabled: diffEnabled ?? false,
shouldShowAnnouncement: lastShownAnnouncementId !== this.latestAnnouncementId,
allowedCommands,
}
@@ -956,6 +967,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
taskHistory,
allowedCommands,
soundEnabled,
diffEnabled,
] = await Promise.all([
this.getGlobalState("apiProvider") as Promise<ApiProvider | undefined>,
this.getGlobalState("apiModelId") as Promise<string | undefined>,
@@ -991,6 +1003,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
this.getGlobalState("taskHistory") as Promise<HistoryItem[] | undefined>,
this.getGlobalState("allowedCommands") as Promise<string[] | undefined>,
this.getGlobalState("soundEnabled") as Promise<boolean | undefined>,
this.getGlobalState("diffEnabled") as Promise<boolean | undefined>,
])
let apiProvider: ApiProvider
@@ -1044,6 +1057,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
taskHistory,
allowedCommands,
soundEnabled,
diffEnabled,
}
}