Implement file header analyzer#41982
Conversation
This comment has been minimized.
This comment has been minimized.
|
I agree to submit this feature with @sharwell to dotnet/roslyn under the terms of the .NET Foundation CLA used for this repository, even though we originally developed the feature in another context and it remains separately licensed for that purpose. |
3468496 to
c77417f
Compare
src/Features/CSharp/Portable/FileHeaders/CSharpFileHeaderCodeFixProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/FileHeaders/CSharpFileHeaderHelper.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/FileHeaders/CSharpFileHeaderHelper.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/FileHeaders/CSharpFileHeaderHelper.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/FileHeaders/CSharpFileHeaderHelper.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/AddFileBanner/AbstractAddFileBannerCodeRefactoringProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/AddFileBanner/AbstractAddFileBannerCodeRefactoringProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/FileHeaders/AbstractFileHeaderCodeFixProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/FileHeaders/AbstractFileHeaderCodeFixProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/FileHeaders/AbstractFileHeaderCodeFixProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/FileHeaders/AbstractFileHeaderCodeFixProvider.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Don't we have a helper for getting a document without the header? Can we reuse that?
There was a problem hiding this comment.
I'm not certain that helper behaves correctly. We can look into using it in the future though.
There was a problem hiding this comment.
- can we try using it and running it against your tests to verify?
- if it doesn't work, i would much rather fix that up. that way all the features in the IDE that care about banners work consistently.
There was a problem hiding this comment.
Only one feature will be active in any given project.
src/Features/Core/Portable/FileHeaders/AbstractFileHeaderCodeFixProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/FileHeaders/AbstractFileHeaderCodeFixProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/FileHeaders/AbstractFileHeaderDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/FileHeaders/AbstractFileHeaderDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/FileHeaders/AbstractFileHeaderDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/FileHeaders/AbstractFileHeaderDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/FileHeaders/AbstractFileHeaderDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Features/VisualBasic/Portable/FileHeaders/VisualBasicFileHeaderCodeFixProvider.vb
Outdated
Show resolved
Hide resolved
src/Features/VisualBasic/Portable/FileHeaders/VisualBasicFileHeaderHelper.vb
Outdated
Show resolved
Hide resolved
...edUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxKinds.vb
Outdated
Show resolved
Hide resolved
|
Def have some strong requests for tweaks around code clarity. Overall design and impl is rock solid and i'm strongly in favor of. But would really like a few things smoothed out first. Thanks! |
82e3577 to
4f262c4
Compare
|
Thanks for all the tidying up changes. it's very appreciated! |
Closes #33012
@vweijsters and myself are submitting this change under the .NET Foundation CLA for dotnet/roslyn. We have licensed this work separately in the past, on non-exclusive basis, to another project, but as the sole original authors of the functionality we have agreed to submit it here independently of that work.
Items remaining to be resolved:
The code fix does not behave correctly when replacing a header that does not start on the first line, and the first line contains a positive amount of whitespace(fixed)Some additional types can be consolidated to avoid code duplication in the C# and Visual Basic implementations(refactored to share)The code fix needs to cooperate with the previous Add file banner refactoring to ensure only one is offered at a time(fixed)file_header_templatesetting in .editorconfig using the content of the header used in the current fileThe diagnostic cannot be suppressing using(fixed)#pragma warning disable