Skip to content
11 changes: 3 additions & 8 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,15 @@
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
],
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "compile",
"env": {
"NODE_ENV": "development",
"VSCODE_DEBUG_MODE": "true"
},
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
]
},
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"]
}
]
}
33 changes: 16 additions & 17 deletions cline_docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@
- Example:
```typescript
<VSCodeCheckbox
checked={multisearchDiffEnabled}
onChange={(e: any) => setMultisearchDiffEnabled(e.target.checked)}
>
<span style={{ fontWeight: "500" }}>Enable multi-search diff matching</span>
checked={multisearchDiffEnabled}
onChange={(e: any) => setMultisearchDiffEnabled(e.target.checked)}>
<span style={{ fontWeight: "500" }}>Enable multi-search diff matching</span>
</VSCodeCheckbox>
```

Expand Down Expand Up @@ -116,19 +115,19 @@
- Example:
```typescript
<select
value={preferredLanguage}
onChange={(e) => setPreferredLanguage(e.target.value)}
style={{
width: "100%",
padding: "4px 8px",
backgroundColor: "var(--vscode-input-background)",
color: "var(--vscode-input-foreground)",
border: "1px solid var(--vscode-input-border)",
borderRadius: "2px"
}}>
<option value="English">English</option>
<option value="Spanish">Spanish</option>
...
value={preferredLanguage}
onChange={(e) => setPreferredLanguage(e.target.value)}
style={{
width: "100%",
padding: "4px 8px",
backgroundColor: "var(--vscode-input-background)",
color: "var(--vscode-input-foreground)",
border: "1px solid var(--vscode-input-border)",
borderRadius: "2px",
}}>
<option value="English">English</option>
<option value="Spanish">Spanish</option>
...
</select>
```

Expand Down
8 changes: 6 additions & 2 deletions src/api/transform/vscode-lm-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export function convertToVsCodeLmMessages(
: (toolMessage.content?.map((part) => {
if (part.type === "image") {
return new vscode.LanguageModelTextPart(
`[Image (${part.source?.type || "Unknown source-type"}): ${part.source?.media_type || "unknown media-type"} not supported by VSCode LM API]`,
`[Image (${part.source?.type || "Unknown source-type"}): ${
part.source?.media_type || "unknown media-type"
} not supported by VSCode LM API]`,
)
}
return new vscode.LanguageModelTextPart(part.text)
Expand All @@ -86,7 +88,9 @@ export function convertToVsCodeLmMessages(
...nonToolMessages.map((part) => {
if (part.type === "image") {
return new vscode.LanguageModelTextPart(
`[Image (${part.source?.type || "Unknown source-type"}): ${part.source?.media_type || "unknown media-type"} not supported by VSCode LM API]`,
`[Image (${part.source?.type || "Unknown source-type"}): ${
part.source?.media_type || "unknown media-type"
} not supported by VSCode LM API]`,
)
}
return new vscode.LanguageModelTextPart(part.text)
Expand Down
15 changes: 14 additions & 1 deletion src/core/Cline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class Cline {
private askResponseImages?: string[]
private lastMessageTs?: number
private consecutiveMistakeCount: number = 0
private apiRetryCount: number = 0
private consecutiveMistakeCountForApplyDiff: Map<string, number> = new Map()
private providerRef: WeakRef<ClineProvider>
private abort: boolean = false
Expand Down Expand Up @@ -884,6 +885,18 @@ export class Cline {
} catch (error) {
// note that this api_req_failed ask is unique in that we only present this option if the api hasn't streamed any content yet (ie it fails on the first chunk due), as it would allow them to hit a retry button. However if the api failed mid-stream, it could be in any arbitrary state where some tools may have executed, so that error is handled differently and requires cancelling the task entirely.
if (alwaysApproveResubmit) {
const { maxApiRetries } = (await this.providerRef.deref()?.getState()) ?? {}
const currentRetryCount = (this.apiRetryCount || 0) + 1
this.apiRetryCount = currentRetryCount

if (maxApiRetries !== undefined && maxApiRetries !== 0 && currentRetryCount > maxApiRetries) {
const errorMsg = `Maximum retry attempts (${maxApiRetries}) reached. ${
error.message ?? "Unknown error"
}`
await this.say("error", errorMsg)
throw error
}

const errorMsg = error.message ?? "Unknown error"
const requestDelay = requestDelaySeconds || 5
// Automatically retry with delay
Expand Down Expand Up @@ -2142,7 +2155,7 @@ export class Cline {
}

/*
Seeing out of bounds is fine, it means that the next too call is being built up and ready to add to assistantMessageContent to present.
Seeing out of bounds is fine, it means that the next too call is being built up and ready to add to assistantMessageContent to present.
When you see the UI inactive during this, it means that a tool is breaking without presenting any UI. For example the write_to_file tool was breaking when relpath was undefined, and for invalid relpath it never presented UI.
*/
this.presentAssistantMessageLocked = false // this needs to be placed here, if not then calling this.presentAssistantMessage below would fail (sometimes) since it's locked
Expand Down
Loading
Loading