Skip to content

EditorConfig Support - #41

Merged
danielmarbach merged 2 commits into
mainfrom
testing
Aug 11, 2026
Merged

EditorConfig Support#41
danielmarbach merged 2 commits into
mainfrom
testing

Conversation

@danielmarbach

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds global and filename-scoped EditorConfig options to analyzer, code-fix, and source-generator tests.

Changes:

  • Adds WithEditorConfigOption.
  • Extends analyzer option providers with per-source configuration.
  • Adds analyzer tests, fake diagnostics, documentation, and API approval.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Documents EditorConfig options.
src/Particular.AnalyzerTesting/BaseCompilationTest.cs Adds the fluent configuration API.
src/Particular.AnalyzerTesting/AnalyzerConfigOptionsFactory.cs Resolves global and per-file options.
src/Particular.AnalyzerTesting/CompilationExtensions.cs Passes options into analyzer execution.
src/Particular.AnalyzerTesting/BaseAnalyzerTest.cs Connects configured options to analyzers.
src/Particular.AnalyzerTesting/SourceGeneratorTest.cs Supplies options to generator runs.
src/FakeAnalyzers/EditorConfigOptionAnalyzer.cs Adds a test analyzer for EditorConfig behavior.
src/FakeAnalyzers/TestFlagAnalyzer.cs Verifies properties are syntax-tree accessible.
src/FakeAnalyzers/DiagnosticIds.cs Adds the test diagnostic ID.
src/FakeAnalyzers/DiagnosticDescriptors.cs Adds the test diagnostic descriptor.
src/Tests/Analyzers/TestFlagAnalyzerTests.cs Tests global and filename-scoped options.
src/Tests/ApprovalFiles/ApiApproval.ApproveApi.approved.txt Approves the new public API.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Particular.AnalyzerTesting/SourceGeneratorTest.cs
Comment thread README.md
| `WithInterceptorNamespace(ns)` | Add an interceptors namespace feature flag to the compilation. |
| `WithProperty(name, value)` | Add an arbitrary build property to the compilation. |
| `WithProperty(name, value)` | Add an arbitrary build property to the compilation. The property is available through global and syntax-tree analyzer config options. |
| `WithEditorConfigOption(name, value, filename)` | Add an EditorConfig option to syntax-tree analyzer config options. Omit `filename` to apply it to all source files; specify a filename to scope it to that source file. EditorConfig options are not available through global analyzer config options. |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still on the fence by this name because roslyn doesn't really seem to care and it could very well be just different WIthProperty overloads

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "Roslyn doesn't really seem to care"?

WithEditorConfig could also work and would be shorter? But I have no problem with the current method name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you look at the underlying data structure, it seems to only understand properties that are global, properties at the file or tree level. That's it. That's why I'm wondering if WithEditorConfig or WithEditorConfigOptions should simply be "overloads of WithProperty"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reflecting about this I think ConfigOptions is nice because if we ever support file loading of editorconfig then WithEditorConfig could be the file based overload.

@danielmarbach
danielmarbach merged commit de01e38 into main Aug 11, 2026
4 checks passed
@danielmarbach
danielmarbach deleted the testing branch August 11, 2026 15:51
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.

4 participants