Skip to content

Commit 974f698

Browse files
authored
Revert "Added option for skipping diff animation. Useful when diff animation …" (RooCodeInc#2341)
This reverts commit 12f16a4.
1 parent 12f16a4 commit 974f698

File tree

5 files changed

+15
-53
lines changed

5 files changed

+15
-53
lines changed

.changeset/moody-rules-repeat.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,6 @@ For example, when working with a local web server, you can use 'Restore Workspac
137137

138138
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
139139

140-
## Settings
141-
142-
Cline provides several settings to customize its behavior:
143-
144-
### Editor Settings
145-
146-
- `cline.editor.skipDiffAnimation`: Disable the animated diff view when Cline makes changes to files. This can significantly speed up file modifications, especially when working with remote repositories. Default: `false`
147-
148140
## Contributing
149141

150142
To contribute to the project, start with our [Contributing Guide](CONTRIBUTING.md) to learn the basics. You can also join our [Discord](https://discord.gg/cline) to chat with other contributors in the `#contributors` channel. If you're looking for full-time work, check out our open positions on our [careers page](https://cline.bot/join-us)!

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,6 @@
182182
"default": null,
183183
"description": "Path to Chrome executable for browser use functionality. If not set, the extension will attempt to find or download it automatically."
184184
},
185-
"cline.editor.skipDiffAnimation": {
186-
"type": "boolean",
187-
"default": false,
188-
"description": "Skip the animation when applying diffs in the editor. Useful for faster updates, especially with remote repositories."
189-
},
190185
"cline.preferredLanguage": {
191186
"type": "string",
192187
"enum": [

src/integrations/editor/DiffViewProvider.ts

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export class DiffViewProvider {
1414
editType?: "create" | "modify"
1515
isEditing = false
1616
originalContent: string | undefined
17-
skipAnimation = false
1817
private createdDirs: string[] = []
1918
private documentWasOpen = false
2019
private relPath?: string
@@ -25,9 +24,7 @@ export class DiffViewProvider {
2524
private streamedLines: string[] = []
2625
private preDiagnostics: [vscode.Uri, vscode.Diagnostic[]][] = []
2726

28-
constructor(private cwd: string) {
29-
this.skipAnimation = vscode.workspace.getConfiguration("cline.editor").get("skipDiffAnimation", false)
30-
}
27+
constructor(private cwd: string) {}
3128

3229
async open(relPath: string): Promise<void> {
3330
this.relPath = relPath
@@ -95,37 +92,27 @@ export class DiffViewProvider {
9592
throw new Error("User closed text editor, unable to edit file...")
9693
}
9794

98-
// Place cursor at the beginning of the diff editor
95+
// Place cursor at the beginning of the diff editor to keep it out of the way of the stream animation
9996
const beginningOfDocument = new vscode.Position(0, 0)
10097
diffEditor.selection = new vscode.Selection(beginningOfDocument, beginningOfDocument)
10198

102-
if (this.skipAnimation) {
103-
// Apply all changes at once if animation is disabled
99+
for (let i = 0; i < diffLines.length; i++) {
100+
const currentLine = this.streamedLines.length + i
101+
// Replace all content up to the current line with accumulated lines
102+
// This is necessary (as compared to inserting one line at a time) to handle cases where html tags on previous lines are auto closed for example
104103
const edit = new vscode.WorkspaceEdit()
105-
const rangeToReplace = new vscode.Range(0, 0, document.lineCount, 0)
106-
const contentToReplace = accumulatedLines.join("\n") + "\n"
104+
const rangeToReplace = new vscode.Range(0, 0, currentLine + 1, 0)
105+
const contentToReplace = accumulatedLines.slice(0, currentLine + 1).join("\n") + "\n"
107106
edit.replace(document.uri, rangeToReplace, contentToReplace)
108107
await vscode.workspace.applyEdit(edit)
109-
this.streamedLines = accumulatedLines
110-
} else {
111-
// Original animation logic
112-
for (let i = 0; i < diffLines.length; i++) {
113-
const currentLine = this.streamedLines.length + i
114-
const edit = new vscode.WorkspaceEdit()
115-
const rangeToReplace = new vscode.Range(0, 0, currentLine + 1, 0)
116-
const contentToReplace = accumulatedLines.slice(0, currentLine + 1).join("\n") + "\n"
117-
edit.replace(document.uri, rangeToReplace, contentToReplace)
118-
await vscode.workspace.applyEdit(edit)
119-
// Update decorations
120-
this.activeLineController.setActiveLine(currentLine)
121-
this.fadedOverlayController.updateOverlayAfterLine(currentLine, document.lineCount)
122-
// Scroll to the current line
123-
this.scrollEditorToLine(currentLine)
124-
}
125-
// Update the streamedLines with the new accumulated content
126-
this.streamedLines = accumulatedLines
108+
// Update decorations
109+
this.activeLineController.setActiveLine(currentLine)
110+
this.fadedOverlayController.updateOverlayAfterLine(currentLine, document.lineCount)
111+
// Scroll to the current line
112+
this.scrollEditorToLine(currentLine)
127113
}
128-
114+
// Update the streamedLines with the new accumulated content
115+
this.streamedLines = accumulatedLines
129116
if (isFinal) {
130117
// Handle any remaining lines if the new content is shorter than the original
131118
if (this.streamedLines.length < document.lineCount) {

src/shared/EditorSettings.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)