Skip to content

Add .editorconfig support for XML style detection#7378

Draft
timtebeek wants to merge 1 commit intomainfrom
tim/editorconfig-xml-style
Draft

Add .editorconfig support for XML style detection#7378
timtebeek wants to merge 1 commit intomainfrom
tim/editorconfig-xml-style

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented Apr 15, 2026

Summary

  • Adds .editorconfig support for XML formatting, starting with indent_style, indent_size, tab_width, and end_of_line. Resolves Pick TabsAndIndentsStyle from .editorconfig #3666.

  • rewrite-core: New EditorConfigParser, EditorConfigResolver, and EditorConfigStyles provide reusable infrastructure for parsing .editorconfig files, walking directories with root = true support, and mapping universal properties to style values.

  • rewrite-xml: New EditorConfigStyleMapper converts resolved properties into NamedStyles (TabsAndIndentsStyle + GeneralFormatStyle) attached as markers on Xml.Document.

  • Integration: Callers opt in by setting an EditorConfigResolver on ParsingExecutionContextView; the parser stays free of implicit disk I/O. Existing AutoFormatVisitor picks up the markers automatically with no changes needed.

Test plan

  • EditorConfigParserTest — parsing sections, comments, root=true, brace expansion, case normalization (8 tests)
  • EditorConfigResolverTest — directory walking, hierarchical override, root=true stopping, caching (8 tests)
  • EditorConfigStylesTest — property-to-style mapping for all supported properties (11 tests)
  • EditorConfigStyleMapperTest — XML style creation from editorconfig properties (6 tests)
  • EditorConfigIntegrationTest — end-to-end: parse XML with .editorconfig on disk, verify styles attached and used (5 tests)
  • Full :rewrite-xml:test suite passes with no regressions

Resolves #3666 — adds infrastructure to read .editorconfig files and
apply indent_style, indent_size, tab_width, and end_of_line settings
as NamedStyles markers on parsed XML documents.

Callers opt in by placing an EditorConfigResolver on the
ParsingExecutionContextView; the parser stays free of implicit disk I/O.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Pick TabsAndIndentsStyle from .editorconfig

1 participant