Skip to content

Commit

Permalink
fix codefix for non readonly fields
Browse files Browse the repository at this point in the history
  • Loading branch information
fakefeik committed Aug 22, 2024
1 parent 6392248 commit 74d8162
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
context.CancellationToken.ThrowIfCancellationRequested();

var node = root.FindNode(context.Span);
if (node is VariableDeclaratorSyntax {Parent: VariableDeclarationSyntax {Parent: FieldDeclarationSyntax field}})
{
node = field;
}

if (node is not FieldDeclarationSyntax originalExpression)
return;

Expand Down

0 comments on commit 74d8162

Please sign in to comment.