@@ -17,6 +17,8 @@ namespace Flow.Launcher.Localization.Analyzers.Localize
17
17
[ ExportCodeFixProvider ( LanguageNames . CSharp , Name = nameof ( ContextAvailabilityAnalyzerCodeFixProvider ) ) , Shared ]
18
18
public class ContextAvailabilityAnalyzerCodeFixProvider : CodeFixProvider
19
19
{
20
+ #region CodeFixProvider
21
+
20
22
public sealed override ImmutableArray < string > FixableDiagnosticIds => ImmutableArray . Create (
21
23
AnalyzerDiagnostics . ContextIsAField . Id ,
22
24
AnalyzerDiagnostics . ContextIsNotStatic . Id ,
@@ -82,21 +84,9 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
82
84
}
83
85
}
84
86
85
- private static MemberDeclarationSyntax GetStaticContextPropertyDeclaration ( string propertyName = "Context" ) =>
86
- SyntaxFactory . ParseMemberDeclaration (
87
- $ "internal static { Constants . PluginContextTypeName } { propertyName } {{ get; private set; }} = null!;"
88
- ) ;
87
+ #endregion
89
88
90
- private static Document GetFormattedDocument ( CodeFixContext context , SyntaxNode root )
91
- {
92
- var formattedRoot = Formatter . Format (
93
- root ,
94
- Formatter . Annotation ,
95
- context . Document . Project . Solution . Workspace
96
- ) ;
97
-
98
- return context . Document . WithSyntaxRoot ( formattedRoot ) ;
99
- }
89
+ #region Fix Methods
100
90
101
91
private static Document FixContextNotDeclared ( CodeFixContext context , SyntaxNode root , TextSpan diagnosticSpan )
102
92
{
@@ -160,6 +150,24 @@ private static Document FixContextIsAFieldError(CodeFixContext context, SyntaxNo
160
150
return GetFormattedDocument ( context , newRoot ) ;
161
151
}
162
152
153
+ #region Utils
154
+
155
+ private static MemberDeclarationSyntax GetStaticContextPropertyDeclaration ( string propertyName = "Context" ) =>
156
+ SyntaxFactory . ParseMemberDeclaration (
157
+ $ "internal static { Constants . PluginContextTypeName } { propertyName } {{ get; private set; }} = null!;"
158
+ ) ;
159
+
160
+ private static Document GetFormattedDocument ( CodeFixContext context , SyntaxNode root )
161
+ {
162
+ var formattedRoot = Formatter . Format (
163
+ root ,
164
+ Formatter . Annotation ,
165
+ context . Document . Project . Solution . Workspace
166
+ ) ;
167
+
168
+ return context . Document . WithSyntaxRoot ( formattedRoot ) ;
169
+ }
170
+
163
171
private static PropertyDeclarationSyntax FixRestrictivePropertyModifiers ( PropertyDeclarationSyntax propertyDeclaration )
164
172
{
165
173
var newModifiers = SyntaxFactory . TokenList ( ) ;
@@ -185,5 +193,9 @@ private static T GetDeclarationSyntax<T>(SyntaxNode root, TextSpan diagnosticSpa
185
193
? . AncestorsAndSelf ( )
186
194
. OfType < T > ( )
187
195
. First ( ) ;
196
+
197
+ #endregion
198
+
199
+ #endregion
188
200
}
189
201
}
0 commit comments