[Feature Request] Trigger VSCode formatOnSave when editing files via VSCode extension

Resolved 💬 2 comments Opened Jan 23, 2026 by niba1122 Closed Jan 23, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

When using Claude Code in the VSCode extension, file edits do not trigger VSCode's formatOnSave or other save-related hooks (like Prettier, ESLint auto-fix, Biome, etc.).

This is because Claude Code writes directly to the filesystem rather than going through VSCode's editor API.

The current workflow requires me to manually save the file in VSCode after Claude edits it, or wait for pre-commit hooks to fix formatting issues later.

Proposed Solution

In the VSCode extension, use VSCode's editor API for file modifications instead of direct filesystem writes:

// Instead of direct fs.writeFile()
const edit = new vscode.WorkspaceEdit();
edit.replace(uri, range, newContent);
await vscode.workspace.applyEdit(edit);
await document.save(); // This triggers formatOnSave

This would trigger the onDidSaveTextDocument event, and VSCode's configured formatOnSave, linters, and other extensions would run automatically.

Alternative Solutions

  1. PostToolUse hooks - Users can configure hooks to run formatters after edits, but this requires manual setup per project and doesn't integrate with VSCode's existing configuration
  1. Manual save - Users can manually save files after Claude edits, but this adds friction to the workflow
  1. Pre-commit hooks - Formatting happens at commit time, but this delays feedback and can cause unexpected diffs

Priority

Low - Nice to have

Feature Category

Other

Use Case Example

Example scenario:

  1. I'm working on a TypeScript/React project with Biome configured for formatOnSave
  2. I ask Claude Code to edit a component file
  3. Claude edits the file, but Biome doesn't run because the save didn't go through VSCode's API
  4. When I commit, pre-commit hooks catch and fix the formatting, creating unnecessary diff noise
  5. With this feature, formatting would happen immediately after Claude's edit, keeping the code consistent

Additional Context

This feature is specific to the VSCode extension

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗