EditorConfig Support - #41
Conversation
There was a problem hiding this comment.
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.
| | `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. | |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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.
No description provided.