Skip to content

Commit 00ef26b

Browse files
committed
fix(files): use pushEditOperations instead of applyEdits to align with VS Code streaming pattern
1 parent 8b21a0c commit 00ef26b

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/files/components/file-viewer

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/text-editor.tsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -446,19 +446,27 @@ export const TextEditor = memo(function TextEditor({
446446
if (content.startsWith(monacoValue) && monacoValue.length < content.length) {
447447
const lastLine = model.getLineCount()
448448
const lastCol = model.getLineMaxColumn(lastLine)
449-
model.applyEdits([
450-
{
451-
range: {
452-
startLineNumber: lastLine,
453-
startColumn: lastCol,
454-
endLineNumber: lastLine,
455-
endColumn: lastCol,
449+
model.pushEditOperations(
450+
null,
451+
[
452+
{
453+
range: {
454+
startLineNumber: lastLine,
455+
startColumn: lastCol,
456+
endLineNumber: lastLine,
457+
endColumn: lastCol,
458+
},
459+
text: content.slice(monacoValue.length),
456460
},
457-
text: content.slice(monacoValue.length),
458-
},
459-
])
461+
],
462+
() => null
463+
)
460464
} else {
461-
model.applyEdits([{ range: model.getFullModelRange(), text: content }])
465+
model.pushEditOperations(
466+
null,
467+
[{ range: model.getFullModelRange(), text: content }],
468+
() => null
469+
)
462470
}
463471
suppressScrollListenerRef.current = false
464472
lastSyncedContentRef.current = content

0 commit comments

Comments
 (0)