-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better diagnostic location for types #5402
Conversation
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/DetectPreviewFeatureAnalyzer.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me, this API could be useful for other analyzers which need to flag the implemented interfaces, would you consider it?
...etAnalyzers/CSharp/Microsoft.NetCore.Analyzers/Runtime/CSharpDetectPreviewFeatureAnalyzer.cs
Outdated
Show resolved
Hide resolved
...etAnalyzers/CSharp/Microsoft.NetCore.Analyzers/Runtime/CSharpDetectPreviewFeatureAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/DetectPreviewFeatureAnalyzer.cs
Show resolved
Hide resolved
public partial {classOrStruct} Zoo"; | ||
|
||
csInput += @": NonPreviewInterface, {|#0:IFoo|} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Here and all other tests:
Not sure why added this string concatenation, do you think it looks better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think it looks better?
Yup. String interpolation uses {}
and the diagnostic markers also use {| |}
. Then I needed to change the code blocks using {
to {{
to construct csInput
, so I decided to just split it at an appropriate place. Is this harder to read though? If it is, then I'll change it in the next PR
Codecov Report
@@ Coverage Diff @@
## release/6.0.1xx #5402 +/- ##
===================================================
- Coverage 95.56% 95.54% -0.02%
===================================================
Files 1257 1259 +2
Lines 289065 289252 +187
Branches 17368 17377 +9
===================================================
+ Hits 276244 276379 +135
- Misses 10500 10540 +40
- Partials 2321 2333 +12 |
I've implemented better diagnostic locations for types implementing preview interfaces. Instead of the diagnostic appearing on the type itself, it now appears on the interface in the interface list. I think this is a good starting point to get feedback first, and if I get sign off here, I can merge this PR and work on improving the diagnostic location for methods and other types with the same approach.