55using System . Linq ;
66using System . Threading ;
77using System . Threading . Tasks ;
8- using CodeDocumentor . Vsix2022 ;
8+ using CodeDocumentor . Helper ;
99using Microsoft . CodeAnalysis ;
1010using Microsoft . CodeAnalysis . CodeActions ;
1111using Microsoft . CodeAnalysis . CodeFixes ;
@@ -18,12 +18,12 @@ namespace CodeDocumentor
1818 /// The class code fix provider.
1919 /// </summary>
2020 [ ExportCodeFixProvider ( LanguageNames . CSharp , Name = nameof ( FileCodeFixProvider ) ) , Shared ]
21- public class FileCodeFixProvider : CodeFixProvider
21+ public class FileCodeFixProvider : BaseCodeFixProvider
2222 {
2323 /// <summary>
2424 /// The title.
2525 /// </summary>
26- private const string title = "Code Documentor this whole file" ;
26+ private const string Title = "Code Documentor this whole file" ;
2727
2828 /// <summary>
2929 /// Gets the fixable diagnostic ids.
@@ -61,26 +61,26 @@ public override sealed async Task RegisterCodeFixesAsync(CodeFixContext context)
6161 return ;
6262#endif
6363 Diagnostic diagnostic = context . Diagnostics . First ( ) ;
64-
64+ var settings = await context . BuildSettingsAsync ( StaticSettings ) ;
6565 //build it up, but check for counts if anything actually needs to be shown
6666 var _nodesTempToReplace = new Dictionary < CSharpSyntaxNode , CSharpSyntaxNode > ( ) ;
6767 Document tempDoc = context . Document ;
6868 SyntaxNode root = await tempDoc . GetSyntaxRootAsync ( context . CancellationToken ) ;
6969 //Order Matters
7070 var neededCommentCount = 0 ;
71- neededCommentCount += PropertyCodeFixProvider . BuildComments ( root , _nodesTempToReplace ) ;
72- neededCommentCount += ConstructorCodeFixProvider . BuildComments ( root , _nodesTempToReplace ) ;
73- neededCommentCount += EnumCodeFixProvider . BuildComments ( root , _nodesTempToReplace ) ;
74- neededCommentCount += FieldCodeFixProvider . BuildComments ( root , _nodesTempToReplace ) ;
75- neededCommentCount += MethodCodeFixProvider . BuildComments ( root , _nodesTempToReplace ) ;
71+ neededCommentCount += PropertyCodeFixProvider . BuildComments ( settings , root , _nodesTempToReplace ) ;
72+ neededCommentCount += ConstructorCodeFixProvider . BuildComments ( settings , root , _nodesTempToReplace ) ;
73+ neededCommentCount += EnumCodeFixProvider . BuildComments ( settings , root , _nodesTempToReplace ) ;
74+ neededCommentCount += FieldCodeFixProvider . BuildComments ( settings , root , _nodesTempToReplace ) ;
75+ neededCommentCount += MethodCodeFixProvider . BuildComments ( settings , root , _nodesTempToReplace ) ;
7676 root = root . ReplaceNodes ( _nodesTempToReplace . Keys , ( n1 , n2 ) =>
7777 {
7878 return _nodesTempToReplace [ n1 ] ;
7979 } ) ;
8080 _nodesTempToReplace . Clear ( ) ;
81- neededCommentCount += InterfaceCodeFixProvider . BuildComments ( root , _nodesTempToReplace ) ;
82- neededCommentCount += ClassCodeFixProvider . BuildComments ( root , _nodesTempToReplace ) ;
83- neededCommentCount += RecordCodeFixProvider . BuildComments ( root , _nodesTempToReplace ) ;
81+ neededCommentCount += InterfaceCodeFixProvider . BuildComments ( settings , root , _nodesTempToReplace ) ;
82+ neededCommentCount += ClassCodeFixProvider . BuildComments ( settings , root , _nodesTempToReplace ) ;
83+ neededCommentCount += RecordCodeFixProvider . BuildComments ( settings , root , _nodesTempToReplace ) ;
8484 var newRoot = root . ReplaceNodes ( _nodesTempToReplace . Keys , ( n1 , n2 ) =>
8585 {
8686 return _nodesTempToReplace [ n1 ] ;
@@ -92,11 +92,10 @@ public override sealed async Task RegisterCodeFixesAsync(CodeFixContext context)
9292
9393 context . RegisterCodeFix (
9494 CodeAction . Create (
95- title : title ,
95+ title : Title ,
9696 createChangedDocument : ( c ) => Task . Run ( ( ) => context . Document . WithSyntaxRoot ( newRoot ) , c ) ,
97- equivalenceKey : title ) ,
97+ equivalenceKey : Title ) ,
9898 diagnostic ) ;
9999 }
100-
101100 }
102101}
0 commit comments