Add .editorconfig support for XML style detection#7378
Draft
Add .editorconfig support for XML style detection#7378
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
.editorconfigsupport for XML formatting, starting withindent_style,indent_size,tab_width, andend_of_line. Resolves Pick TabsAndIndentsStyle from .editorconfig #3666.rewrite-core: NewEditorConfigParser,EditorConfigResolver, andEditorConfigStylesprovide reusable infrastructure for parsing.editorconfigfiles, walking directories withroot = truesupport, and mapping universal properties to style values.rewrite-xml: NewEditorConfigStyleMapperconverts resolved properties intoNamedStyles(TabsAndIndentsStyle+GeneralFormatStyle) attached as markers onXml.Document.Integration: Callers opt in by setting an
EditorConfigResolveronParsingExecutionContextView; the parser stays free of implicit disk I/O. ExistingAutoFormatVisitorpicks 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.editorconfigon disk, verify styles attached and used (5 tests):rewrite-xml:testsuite passes with no regressions