Skip to content

Auto save on focus change does not trigger cleanup, only manual save #120

@Christopher-C-Robinson

Description

@Christopher-C-Robinson

The extension is not cleaning up extra blank lines when VS Code auto saves the file. The cleanup only happens when I explicitly save with Ctrl+S.

I use VS Code auto save set to save on focus change (when I click out of the file). With that setup, the extension does not format or remove extra blank lines on auto save, but does work correctly when I press Ctrl+S.

Current behavior

  • With files.autoSave set to onFocusChange
  • Extra blank lines or other cleanup targets stay in the file when I switch focus to another editor or file
  • If I then press Ctrl+S manually, the extension runs and cleans up the file as expected

Expected behavior
The same cleanup that happens on a manual save with Ctrl+S should also run when VS Code auto saves on focus change, so the file is always cleaned up whenever VS Code saves it.

Steps to reproduce

  1. Enable the extension
  2. Set VS Code setting files.autoSave to onFocusChange
  3. Open a TypeScript file
  4. Add some extra blank lines that the extension would normally remove
  5. Click into another file or editor so that VS Code auto saves the file
  6. Observe that the extra lines are still there
  7. Press Ctrl+S
  8. Observe that now the extension runs and the extra lines are removed

Environment

Version: 1.105.1 (user setup)
Commit: 7d842fb85a0275a4a8e4d7e040d2625abbf7f084
Date: 2025-10-14T22:33:36.618Z
Electron: 37.6.0
ElectronBuildId: 12502201
Chromium: 138.0.7204.251
Node.js: 22.19.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.22631
Extension version: Currently using the version from the PR #119

  • files.autoSave: onFocusChange

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions