What happened?
While typing in an open .docx, the native OS "Save As" file picker pops up roughly 1 second after I stop typing — interrupting the flow. Dismissing it and continuing to type brings it back again after the next pause. files.autoSave is off in my VSCode settings, so this isn't VSCode's own autosave.
Steps to reproduce
Open any .docx with SuperDoc in VSCode, type continuously, then pause. Dialog appears ~1s after each pause in typing, repeatedly
SuperDoc version
v. 2.18.1
Browser
None
Additional context
There appear to be two independent autosave mechanisms running at once:
-
AUTO_SAVE_DELAY = 1000 (main.js ~line 320808) drives scheduleAutoSave() (~320884), triggered on every editor "update" event. After 1s idle it calls saveDocument() (~320892), which exports the doc and sends it to the extension host via vscode.postMessage({type: "update", content: ...}). The extension host (extension.js lines 129-134) writes the file directly with vscode.workspace.fs.writeFile. This path is silent and correct.
-
Separately, the bundled editor core (Editor.save() / saveTo(), main.js ~line 239754-239768) is generic library code presumably meant for the standalone superdoc.dev web product. It calls an internal writeToPath_fn (~line 240999-241021), which tries fs.writeFileSync (Node) first, and — since a VSCode webview has no Node fs access — falls through to window.showSaveFilePicker() (the File System Access API), which is what actually produces the native OS dialog.
Both appear to fire around the same ~1s idle window, so the correct silent save (path 1) and the buggy native-dialog save (path 2) are racing each other. Path 1 already persists the file, so path 2 is redundant as well as disruptive.
Suggested fix: the VSCode extension wrapper should explicitly disable/no-op the core editor's own autosave-to-path behavior (or never call .save()/.saveTo() with a resolved sourcePath in this context) since the extension already implements its own correct save flow via postMessage.
Repro: Open any .docx with SuperDoc in VSCode, type continuously, then pause. Dialog appears ~1s after each pause in typing, repeatedly
What happened?
While typing in an open .docx, the native OS "Save As" file picker pops up roughly 1 second after I stop typing — interrupting the flow. Dismissing it and continuing to type brings it back again after the next pause.
files.autoSaveis off in my VSCode settings, so this isn't VSCode's own autosave.Steps to reproduce
Open any .docx with SuperDoc in VSCode, type continuously, then pause. Dialog appears ~1s after each pause in typing, repeatedly
SuperDoc version
v. 2.18.1
Browser
None
Additional context
There appear to be two independent autosave mechanisms running at once:
AUTO_SAVE_DELAY = 1000(main.js ~line 320808) drivesscheduleAutoSave()(~320884), triggered on every editor"update"event. After 1s idle it callssaveDocument()(~320892), which exports the doc and sends it to the extension host viavscode.postMessage({type: "update", content: ...}). The extension host (extension.jslines 129-134) writes the file directly withvscode.workspace.fs.writeFile. This path is silent and correct.Separately, the bundled editor core (
Editor.save()/saveTo(), main.js ~line 239754-239768) is generic library code presumably meant for the standalone superdoc.dev web product. It calls an internalwriteToPath_fn(~line 240999-241021), which triesfs.writeFileSync(Node) first, and — since a VSCode webview has no Node fs access — falls through towindow.showSaveFilePicker()(the File System Access API), which is what actually produces the native OS dialog.Both appear to fire around the same ~1s idle window, so the correct silent save (path 1) and the buggy native-dialog save (path 2) are racing each other. Path 1 already persists the file, so path 2 is redundant as well as disruptive.
Suggested fix: the VSCode extension wrapper should explicitly disable/no-op the core editor's own autosave-to-path behavior (or never call
.save()/.saveTo()with a resolvedsourcePathin this context) since the extension already implements its own correct save flow viapostMessage.Repro: Open any .docx with SuperDoc in VSCode, type continuously, then pause. Dialog appears ~1s after each pause in typing, repeatedly