Skip to content

Feature: make auto-save optional (manual save + Ctrl+S) with an unsaved-changes indicator #226

Description

@tomasmorello

Problem

Currently the editor saves the file on every change (debounced ~500ms). While
convenient, this means a half-finished or accidental edit is written to disk
immediately — there is no way to "try something" without persisting it nor undo. This has
led to me accidentally breaking config files.

Proposal

Add an opt-out for auto-save, keeping the current behaviour as the default:

  • An Auto-save toggle in the editor toolbar (persisted in localStorage).
    Default: on, so nothing changes for existing users.
  • When auto-save is off:
    • Save explicitly via a save button (disk icon) or Ctrl/Cmd+S.
    • Unsaved edits are kept as an in-memory draft, so switching tabs does not
      discard them.
    • Files with unsaved changes are flagged in the file tree (a small amber dot,
      kept visually distinct from the existing docker status indicator).
  • Ctrl/Cmd+S also works with auto-save on (flushes the debounce immediately)
    and prevents the browser's default save dialog.

Notes / open questions

  • Undo history is preserved across tab switches by giving each file its own
    Monaco model (keepCurrentModel). It is intentionally not persisted across
    a full page reload (Monaco has no public API to serialize the undo stack).
  • Should manual mode be the default instead of auto-save? I kept auto-save as the
    default to avoid changing current behaviour, but happy to flip it.

I already have an implementation ready and can open a PR if this sounds good.
Tagging @RA341 for thoughts on the approach / defaults before I submit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions