Skip to content

Honor scoped .editorconfig settings in Roslyn formatter requests#9402

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-formatter-ignores-editorconfig
Draft

Honor scoped .editorconfig settings in Roslyn formatter requests#9402
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-formatter-ignores-editorconfig

Conversation

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Roslyn-formatting requests were ignoring document-scoped configuration, so .editorconfig values such as indent_size and csharp_new_line_before_open_brace were not applied in newer extension versions. This updates the LSP configuration path to return per-document formatting settings instead of falling back to global defaults.

  • Root cause

    • workspace/configuration requests with scopeUri were treated as unsupported in the Roslyn LSP middleware.
    • That caused formatter option lookups to return null for document-scoped settings, bypassing .editorconfig-resolved values.
  • Change

    • Update configurationMiddleware to resolve settings with the request scope:
      • use { languageId: 'csharp', uri } when scopeUri is present
      • continue to use C# language-scoped defaults when no URI is provided
    • Update universalEditorConfigProvider to read fallback VS Code formatting settings from the same scope instead of an unscoped configuration object.
  • Regression coverage

    • Add unit coverage for scoped configuration reads and scoped fallback resolution.
    • Strengthen the existing formatting integration asset/test to validate both:
      • brace placement from .editorconfig
      • indentation width from .editorconfig
  • Example

    [*.cs]
    indent_size = 2
    indent_style = space
    csharp_new_line_before_open_brace = none

    With this change, formatting requests for that document now resolve options from the document scope, so output follows the file’s .editorconfig instead of extension/global defaults.

Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix formatter issue with .editorconfig in v2.100.5 and v2.110.4 Honor scoped .editorconfig settings in Roslyn formatter requests Jun 8, 2026
Copilot AI requested a review from mwiemer-microsoft June 8, 2026 17:46
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.

v2.100.5 and v2.110.4 formatter ignores .editorconfig

2 participants