Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

Description

VS Code's editor.formatOnSaveMode: "modifications" setting formats only modified lines by invoking the range formatter. The extension previously registered range formatting for only 7 languages (JavaScript, TypeScript, JSON, JSONC, GraphQL), causing the feature to fail for CSS, HTML, Markdown, and other Prettier-supported languages.

Changes:

  • Removed hardcoded allRangeLanguages array limiting range formatting to 7 languages
  • Register DocumentRangeFormattingEditProvider for all Prettier-supported languages via the existing allLanguages array
  • Added test coverage for CSS, HTML, and Markdown range formatting

Result:
Users can now combine editor.formatOnSaveMode: "modifications" with editor.defaultFormatter: "esbenp.prettier-vscode" for any Prettier-supported file type.

Related Issue

Fixes #3506

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/Build changes

Checklist

  • I have read the CONTRIBUTING guidelines
  • My code follows the code style of this project (npm run lint passes)
  • I have run npm run prettier to format my code
  • I have added/updated tests that prove my fix or feature works
  • All new and existing tests pass (npm test)
  • I have updated the CHANGELOG.md with a summary of my changes

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/prettier-vscode/prettier-vscode/node_modules/.bin/vscode-test (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Support for "editor.formatOnSaveMode": "modifications" in vs-code setting</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
I can't use together

  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSaveMode": "modifications",

Describe the solution you'd like
I would like format all modifications by prettier-vscode when i saved a file

Describe alternatives you've considered
I'm using vs-code format default

Context
microsoft/vscode#249960 (comment)
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Support for editor.formatOnSaveMode: modifications in VS Code settings Support editor.formatOnSaveMode: modifications for all Prettier languages Dec 2, 2025
Copilot AI requested a review from ntotten December 2, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for "editor.formatOnSaveMode": "modifications" in vs-code setting

2 participants