You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.CodeFixers/UseGeneratedDependencyPropertyOnManualPropertyCodeFixer.cs
+49-18Lines changed: 49 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -46,8 +46,8 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
46
46
Diagnosticdiagnostic=context.Diagnostics[0];
47
47
TextSpandiagnosticSpan=context.Span;
48
48
49
-
// We can only possibly fix diagnostics with an additional location
50
-
if(diagnostic.AdditionalLocationsis not [{}fieldLocation])
49
+
// We always expect the field location to be the first additional location, this must be present
50
+
if(diagnostic.AdditionalLocationsis not [{}fieldLocation, ..])
51
51
{
52
52
return;
53
53
}
@@ -62,6 +62,9 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
/// <param name="propertyDeclaration">The <see cref="PropertyDeclarationSyntax"/> for the property being updated.</param>
216
233
/// <param name="fieldDeclaration">The <see cref="FieldDeclarationSyntax"/> for the declared property to remove.</param>
217
234
/// <param name="defaultValueExpression">The expression for the default value of the property, if present</param>
218
-
/// <param name="defaultValueTypeFullyQualifiedMetadataName">The fully qualified metadata name of the default value, if present.</param>
235
+
/// <param name="defaultValueTypeReferenceId">The documentation comment reference id for type of the default value, if present.</param>
236
+
/// <param name="defaultValueExpressionLocation">The location for the default value, if available.</param>
219
237
/// <returns>An updated document with the applied code fix, and <paramref name="propertyDeclaration"/> being replaced with a partial property.</returns>
/// <param name="document">The original document being fixed.</param>
260
281
/// <param name="semanticModel">The <see cref="SemanticModel"/> instance for the current compilation.</param>
282
+
/// <param name="root">The original tree root belonging to the current document.</param>
261
283
/// <param name="propertyDeclaration">The <see cref="PropertyDeclarationSyntax"/> for the property being updated.</param>
262
284
/// <param name="fieldDeclaration">The <see cref="FieldDeclarationSyntax"/> for the declared property to remove.</param>
263
285
/// <param name="generatedDependencyPropertyAttributeList">The <see cref="AttributeListSyntax"/> with the attribute to add.</param>
264
286
/// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> instance to use.</param>
265
287
/// <param name="defaultValueExpression">The expression for the default value of the property, if present</param>
266
-
/// <param name="defaultValueTypeFullyQualifiedMetadataName">The fully qualified metadata name of the default value, if present.</param>
288
+
/// <param name="defaultValueTypeReferenceId">The documentation comment reference id for type of the default value, if present.</param>
289
+
/// <param name="defaultValueExpressionLocation">The location for the default value, if available.</param>
267
290
/// <returns>An updated document with the applied code fix, and <paramref name="propertyDeclaration"/> being replaced with a partial property.</returns>
Copy file name to clipboardExpand all lines: components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/Diagnostics/Analyzers/UseGeneratedDependencyPropertyOnManualPropertyAnalyzer.cs
Copy file name to clipboardExpand all lines: components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.Tests/Test_UseGeneratedDependencyPropertyOnManualPropertyCodeFixer.cs
+90Lines changed: 90 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -544,6 +544,96 @@ public partial class MyControl : Control
0 commit comments