|
|
@@ -85,6 +85,7 @@ type GlobalStateKey =
|
|
|
| "mcpEnabled"
|
|
|
| "alwaysApproveResubmit"
|
|
|
| "requestDelaySeconds"
|
|
|
+ | "experimentalDiffStrategy"
|
|
|
export const GlobalFileNames = {
|
|
|
apiConversationHistory: "api_conversation_history.json",
|
|
|
uiMessages: "ui_messages.json",
|
|
|
@@ -233,7 +234,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
apiConfiguration,
|
|
|
customInstructions,
|
|
|
diffEnabled,
|
|
|
- fuzzyMatchThreshold
|
|
|
+ fuzzyMatchThreshold,
|
|
|
+ experimentalDiffStrategy
|
|
|
} = await this.getState()
|
|
|
|
|
|
this.cline = new Cline(
|
|
|
@@ -243,7 +245,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
diffEnabled,
|
|
|
fuzzyMatchThreshold,
|
|
|
task,
|
|
|
- images
|
|
|
+ images,
|
|
|
+ undefined,
|
|
|
+ experimentalDiffStrategy
|
|
|
)
|
|
|
}
|
|
|
|
|
|
@@ -253,7 +257,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
apiConfiguration,
|
|
|
customInstructions,
|
|
|
diffEnabled,
|
|
|
- fuzzyMatchThreshold
|
|
|
+ fuzzyMatchThreshold,
|
|
|
+ experimentalDiffStrategy
|
|
|
} = await this.getState()
|
|
|
|
|
|
this.cline = new Cline(
|
|
|
@@ -264,7 +269,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
fuzzyMatchThreshold,
|
|
|
undefined,
|
|
|
undefined,
|
|
|
- historyItem
|
|
|
+ historyItem,
|
|
|
+ experimentalDiffStrategy
|
|
|
)
|
|
|
}
|
|
|
|
|
|
@@ -805,6 +811,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
+ case "experimentalDiffStrategy":
|
|
|
+ await this.updateGlobalState("experimentalDiffStrategy", message.bool ?? false)
|
|
|
+ await this.postStateToWebview()
|
|
|
+ break
|
|
|
}
|
|
|
},
|
|
|
null,
|
|
|
@@ -1155,7 +1165,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
uiMessagesFilePath: string
|
|
|
apiConversationHistory: Anthropic.MessageParam[]
|
|
|
}> {
|
|
|
- const history = ((await this.getGlobalState("taskHistory")) as HistoryItem[] | undefined) || []
|
|
|
+ const history = (await this.getGlobalState("taskHistory") as HistoryItem[] | undefined) || []
|
|
|
const historyItem = history.find((item) => item.id === id)
|
|
|
if (historyItem) {
|
|
|
const taskDirPath = path.join(this.context.globalStorageUri.fsPath, "tasks", id)
|
|
|
@@ -1220,7 +1230,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
|
|
|
async deleteTaskFromState(id: string) {
|
|
|
// Remove the task from history
|
|
|
- const taskHistory = ((await this.getGlobalState("taskHistory")) as HistoryItem[]) || []
|
|
|
+ const taskHistory = (await this.getGlobalState("taskHistory") as HistoryItem[]) || []
|
|
|
const updatedTaskHistory = taskHistory.filter((task) => task.id !== id)
|
|
|
await this.updateGlobalState("taskHistory", updatedTaskHistory)
|
|
|
|
|
|
@@ -1256,6 +1266,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
mcpEnabled,
|
|
|
alwaysApproveResubmit,
|
|
|
requestDelaySeconds,
|
|
|
+ experimentalDiffStrategy,
|
|
|
} = await this.getState()
|
|
|
|
|
|
const allowedCommands = vscode.workspace
|
|
|
@@ -1290,6 +1301,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
mcpEnabled: mcpEnabled ?? true,
|
|
|
alwaysApproveResubmit: alwaysApproveResubmit ?? false,
|
|
|
requestDelaySeconds: requestDelaySeconds ?? 5,
|
|
|
+ experimentalDiffStrategy: experimentalDiffStrategy ?? false,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1397,6 +1409,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
mcpEnabled,
|
|
|
alwaysApproveResubmit,
|
|
|
requestDelaySeconds,
|
|
|
+ experimentalDiffStrategy,
|
|
|
] = await Promise.all([
|
|
|
this.getGlobalState("apiProvider") as Promise<ApiProvider | undefined>,
|
|
|
this.getGlobalState("apiModelId") as Promise<string | undefined>,
|
|
|
@@ -1449,6 +1462,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
this.getGlobalState("mcpEnabled") as Promise<boolean | undefined>,
|
|
|
this.getGlobalState("alwaysApproveResubmit") as Promise<boolean | undefined>,
|
|
|
this.getGlobalState("requestDelaySeconds") as Promise<number | undefined>,
|
|
|
+ this.getGlobalState("experimentalDiffStrategy") as Promise<boolean | undefined>,
|
|
|
])
|
|
|
|
|
|
let apiProvider: ApiProvider
|
|
|
@@ -1545,16 +1559,25 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
mcpEnabled: mcpEnabled ?? true,
|
|
|
alwaysApproveResubmit: alwaysApproveResubmit ?? false,
|
|
|
requestDelaySeconds: requestDelaySeconds ?? 5,
|
|
|
+ experimentalDiffStrategy: experimentalDiffStrategy ?? false,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async updateTaskHistory(item: HistoryItem): Promise<HistoryItem[]> {
|
|
|
- const history = ((await this.getGlobalState("taskHistory")) as HistoryItem[]) || []
|
|
|
+ const history = (await this.getGlobalState("taskHistory") as HistoryItem[] | undefined) || []
|
|
|
const existingItemIndex = history.findIndex((h) => h.id === item.id)
|
|
|
+
|
|
|
+ // Ensure experimentalDiffStrategy is included from current settings if not already set
|
|
|
+ const { experimentalDiffStrategy } = await this.getState() ?? {}
|
|
|
+ const updatedItem = {
|
|
|
+ ...item,
|
|
|
+ experimentalDiffStrategy: item.experimentalDiffStrategy ?? experimentalDiffStrategy
|
|
|
+ }
|
|
|
+
|
|
|
if (existingItemIndex !== -1) {
|
|
|
- history[existingItemIndex] = item
|
|
|
+ history[existingItemIndex] = updatedItem
|
|
|
} else {
|
|
|
- history.push(item)
|
|
|
+ history.push(updatedItem)
|
|
|
}
|
|
|
await this.updateGlobalState("taskHistory", history)
|
|
|
return history
|