Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
48e25b2
Switch to async
CyrusNajmabadi Dec 17, 2025
0254afa
Fix
CyrusNajmabadi Dec 18, 2025
58e6612
Merge remote-tracking branch 'origin/taskHelper' into runNewAsync
CyrusNajmabadi Dec 18, 2025
471e05e
Fix
CyrusNajmabadi Dec 18, 2025
3cbf105
Fix
CyrusNajmabadi Dec 18, 2025
0a9d402
fix
CyrusNajmabadi Dec 18, 2025
39f0332
fix
CyrusNajmabadi Dec 18, 2025
52c0020
fix
CyrusNajmabadi Dec 18, 2025
313fbb7
fix
CyrusNajmabadi Dec 18, 2025
0aa24c3
Fix
CyrusNajmabadi Dec 18, 2025
d127c5f
Revert "Fix"
CyrusNajmabadi Dec 18, 2025
a36adc5
Cleanup
CyrusNajmabadi Dec 18, 2025
5b70376
Cleanup
CyrusNajmabadi Dec 18, 2025
7ac1805
Cleanup
CyrusNajmabadi Dec 18, 2025
c374009
Merge remote-tracking branch 'upstream/main' into runNewAsync
CyrusNajmabadi Dec 18, 2025
32e329f
Cleanup
CyrusNajmabadi Dec 18, 2025
3944797
revert
CyrusNajmabadi Dec 18, 2025
48250ed
revert
CyrusNajmabadi Dec 18, 2025
8d3cfd6
revert
CyrusNajmabadi Dec 18, 2025
51cc259
revert
CyrusNajmabadi Dec 18, 2025
ba90fe8
revert
CyrusNajmabadi Dec 18, 2025
6c27edb
revert
CyrusNajmabadi Dec 18, 2025
312c8eb
revert
CyrusNajmabadi Dec 18, 2025
da136f9
Merge remote-tracking branch 'upstream/main' into runNewAsync
CyrusNajmabadi Dec 18, 2025
7f99cf5
switch to valuetask
CyrusNajmabadi Dec 18, 2025
67aea3e
revert
CyrusNajmabadi Dec 18, 2025
6f77e7d
switch to valuetask
CyrusNajmabadi Dec 18, 2025
dcea775
switch to valuetask
CyrusNajmabadi Dec 18, 2025
64b41d6
switch to valuetask
CyrusNajmabadi Dec 18, 2025
9f5c8e4
switch to valuetask
CyrusNajmabadi Dec 18, 2025
0dee1e9
switch to valuetask
CyrusNajmabadi Dec 18, 2025
0d1362f
switch to valuetask
CyrusNajmabadi Dec 18, 2025
1094eb5
switch to valuetask
CyrusNajmabadi Dec 18, 2025
5aebef6
switch to valuetask
CyrusNajmabadi Dec 18, 2025
adcdad0
switch to valuetask
CyrusNajmabadi Dec 18, 2025
0299a90
revert
CyrusNajmabadi Dec 18, 2025
3ddd7ac
switch to valuetask
CyrusNajmabadi Dec 18, 2025
5755d7c
revert
CyrusNajmabadi Dec 18, 2025
c822bee
revert
CyrusNajmabadi Dec 18, 2025
caacfb5
revert
CyrusNajmabadi Dec 18, 2025
f0efe2c
revert
CyrusNajmabadi Dec 18, 2025
6f47356
Make async
CyrusNajmabadi Dec 18, 2025
c8f9caf
Make async
CyrusNajmabadi Dec 18, 2025
ab76e4b
Revert
CyrusNajmabadi Dec 18, 2025
e2f646b
Back to task
CyrusNajmabadi Dec 19, 2025
514d16c
Simplify
CyrusNajmabadi Dec 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ internal sealed class CSharpAddBracesCodeFixProvider() : SyntaxEditorBasedCodeFi
public override ImmutableArray<string> FixableDiagnosticIds
=> [IDEDiagnosticIds.AddBracesDiagnosticId];

public sealed override Task RegisterCodeFixesAsync(CodeFixContext context)
public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
RegisterCodeFix(context, CSharpAnalyzersResources.Add_braces, nameof(CSharpAnalyzersResources.Add_braces));
return Task.CompletedTask;
}

protected override Task FixAllAsync(
protected override async Task FixAllAsync(
Document document, ImmutableArray<Diagnostic> diagnostics,
SyntaxEditor editor, CancellationToken cancellationToken)
{
Expand All @@ -47,7 +46,5 @@ protected override Task FixAllAsync(
return embeddedStatement is null ? currentStatement : currentStatement.ReplaceNode(embeddedStatement, SyntaxFactory.Block(embeddedStatement));
});
}

return Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal sealed class ConvertNamespaceCodeFixProvider() : SyntaxEditorBasedCodeF
public override ImmutableArray<string> FixableDiagnosticIds
=> [IDEDiagnosticIds.UseBlockScopedNamespaceDiagnosticId, IDEDiagnosticIds.UseFileScopedNamespaceDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var diagnostic = context.Diagnostics.First();

Expand All @@ -41,7 +41,6 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
});

RegisterCodeFix(context, title, equivalenceKey);
return Task.CompletedTask;
}

protected override async Task FixAllAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ internal sealed partial class ConvertSwitchStatementToExpressionCodeFixProvider(
public override ImmutableArray<string> FixableDiagnosticIds
=> [IDEDiagnosticIds.ConvertSwitchStatementToExpressionDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
RegisterCodeFix(context, CSharpAnalyzersResources.Convert_switch_statement_to_expression, nameof(CSharpAnalyzersResources.Convert_switch_statement_to_expression));
return Task.CompletedTask;
}

protected override async Task FixAllAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static bool TryGetConstraint(
return enumOrDelegateKeyword.Kind() is SyntaxKind.EnumKeyword or SyntaxKind.DelegateKeyword;
}

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var cancellationToken = context.CancellationToken;

Expand All @@ -69,8 +69,6 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
{
RegisterCodeFix(context, CSharpCodeFixesResources.Fix_constraint, nameof(CSharpFixIncorrectConstraintCodeFixProvider));
}

return Task.CompletedTask;
}

protected override async Task FixAllAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ internal sealed partial class CSharpInlineDeclarationCodeFixProvider() : SyntaxE
public override ImmutableArray<string> FixableDiagnosticIds
=> [IDEDiagnosticIds.InlineDeclarationDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
RegisterCodeFix(context, CSharpAnalyzersResources.Inline_variable_declaration, nameof(CSharpAnalyzersResources.Inline_variable_declaration));
return Task.CompletedTask;
}

protected override async Task FixAllAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ internal sealed partial class InvokeDelegateWithConditionalAccessCodeFixProvider
protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
=> !diagnostic.Properties.ContainsKey(WellKnownDiagnosticTags.Unnecessary);

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
RegisterCodeFix(context, CSharpAnalyzersResources.Simplify_delegate_invocation, nameof(CSharpAnalyzersResources.Simplify_delegate_invocation));
return Task.CompletedTask;
}

protected override Task FixAllAsync(
protected override async Task FixAllAsync(
Document document, ImmutableArray<Diagnostic> diagnostics,
SyntaxEditor editor, CancellationToken cancellationToken)
{
Expand All @@ -50,8 +49,6 @@ protected override Task FixAllAsync(
cancellationToken.ThrowIfCancellationRequested();
AddEdits(editor, diagnostic, cancellationToken);
}

return Task.CompletedTask;
}

private static void AddEdits(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public override ImmutableArray<string> FixableDiagnosticIds

return CodeAction.Create(
CSharpCodeFixesResources.Replace_return_with_yield_return,
_ => Task.FromResult(document.WithSyntaxRoot(root)),
async _ => document.WithSyntaxRoot(root),
nameof(CSharpCodeFixesResources.Replace_return_with_yield_return));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ internal sealed class CSharpChangeToIEnumerableCodeFixProvider() : AbstractItera
type.ToMinimalDisplayString(model, node.SpanStart),
ienumerableGenericSymbol.ToMinimalDisplayString(model, node.SpanStart));

return CodeAction.Create(title, _ => Task.FromResult(newDocument), title);
return CodeAction.Create(title, async _ => newDocument, title);
}

private static bool TryGetIEnumerableSymbols(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,16 @@ internal sealed class CSharpMakeAnonymousFunctionStaticCodeFixProvider() : Synta
public override ImmutableArray<string> FixableDiagnosticIds { get; } =
[IDEDiagnosticIds.MakeAnonymousFunctionStaticDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
RegisterCodeFix(
context,
CSharpAnalyzersResources.Make_anonymous_function_static,
nameof(CSharpAnalyzersResources.Make_anonymous_function_static),
context.Diagnostics[0].Severity > DiagnosticSeverity.Hidden ? CodeActionPriority.Default : CodeActionPriority.Low);

return Task.CompletedTask;
}

protected override Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
{
var generator = editor.Generator;

Expand All @@ -44,7 +42,5 @@ protected override Task FixAllAsync(Document document, ImmutableArray<Diagnostic
var anonymousFunction = diagnostic.Location.FindNode(getInnermostNodeForTie: true, cancellationToken);
editor.ReplaceNode(anonymousFunction, static (node, generator) => generator.WithModifiers(node, generator.GetModifiers(node).WithIsStatic(true)));
}

return Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,16 @@ internal sealed class MakeLocalFunctionStaticCodeFixProvider() : SyntaxEditorBas
public override ImmutableArray<string> FixableDiagnosticIds { get; } =
[IDEDiagnosticIds.MakeLocalFunctionStaticDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
RegisterCodeFix(context, CSharpAnalyzersResources.Make_local_function_static, nameof(CSharpAnalyzersResources.Make_local_function_static));
return Task.CompletedTask;
}

protected override Task FixAllAsync(
protected override async Task FixAllAsync(
Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
{
var localFunctions = diagnostics.SelectAsArray(d => d.AdditionalLocations[0].FindNode(getInnermostNodeForTie: true, cancellationToken));
foreach (var localFunction in localFunctions)
editor.ReplaceNode(localFunction, MakeLocalFunctionStaticCodeFixHelper.AddStaticModifier);

return Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
return WrapFixAsync(
context.Document,
[diagnostic],
(document, localFunction, captures) =>
async (document, localFunction, captures) =>
{
context.RegisterCodeFix(
CodeAction.Create(
CSharpCodeFixesResources.Pass_in_captured_variables_as_arguments,
cancellationToken => MakeLocalFunctionStaticCodeFixHelper.MakeLocalFunctionStaticAsync(document, localFunction, captures, cancellationToken),
nameof(CSharpCodeFixesResources.Pass_in_captured_variables_as_arguments)),
diagnostic);

return Task.CompletedTask;
},
context.CancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
};
}

protected override Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
{
var root = editor.OriginalRoot;
var generator = editor.Generator;
Expand Down Expand Up @@ -138,7 +138,5 @@ protected override Task FixAllAsync(Document document, ImmutableArray<Diagnostic
var newDeclarationModifiers = declarationModifiers.WithIsRequired(true);
editor.ReplaceNode(memberDeclarator, generator.WithModifiers(memberDeclarator, newDeclarationModifiers));
}

return Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
RegisterCodeFix(context, CSharpCodeFixesResources.Add_await, nameof(CSharpCodeFixesResources.Add_await));
}

protected override Task FixAllAsync(
protected override async Task FixAllAsync(
Document document, ImmutableArray<Diagnostic> diagnostics,
SyntaxEditor editor, CancellationToken cancellationToken)
{
Expand All @@ -57,8 +57,6 @@ protected override Task FixAllAsync(
MakeStatementAsynchronous(editor, statementToFix);
}
}

return Task.CompletedTask;
}

private static void MakeStatementAsynchronous(SyntaxEditor editor, SyntaxNode statementToFix)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ internal sealed class CSharpMakeStructFieldsWritableCodeFixProvider() : SyntaxEd
public override ImmutableArray<string> FixableDiagnosticIds
=> [IDEDiagnosticIds.MakeStructFieldsWritable];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
RegisterCodeFix(context, CSharpAnalyzersResources.Make_readonly_fields_writable, nameof(CSharpAnalyzersResources.Make_readonly_fields_writable));
return Task.CompletedTask;
}

protected override Task FixAllAsync(
protected override async Task FixAllAsync(
Document document,
ImmutableArray<Diagnostic> diagnostics,
SyntaxEditor editor,
Expand Down Expand Up @@ -61,7 +60,5 @@ protected override Task FixAllAsync(
}
}
}

return Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ internal sealed class CSharpMakeStructMemberReadOnlyCodeFixProvider() : SyntaxEd
public override ImmutableArray<string> FixableDiagnosticIds { get; } =
[IDEDiagnosticIds.MakeStructMemberReadOnlyDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
RegisterCodeFix(context, CSharpAnalyzersResources.Make_member_readonly, nameof(CSharpAnalyzersResources.Make_member_readonly));
return Task.CompletedTask;
}

protected override Task FixAllAsync(
protected override async Task FixAllAsync(
Document document,
ImmutableArray<Diagnostic> diagnostics,
SyntaxEditor editor,
Expand Down Expand Up @@ -95,7 +94,7 @@ protected override Task FixAllAsync(
}
}

return Task.CompletedTask;
return;

TNode UpdateReadOnlyModifier<TNode>(TNode node, bool add) where TNode : SyntaxNode
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ internal sealed class CSharpMakeStructReadOnlyCodeFixProvider() : SyntaxEditorBa
public override ImmutableArray<string> FixableDiagnosticIds { get; } =
[IDEDiagnosticIds.MakeStructReadOnlyDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
RegisterCodeFix(context, CSharpAnalyzersResources.Make_struct_readonly, nameof(CSharpAnalyzersResources.Make_struct_readonly));
return Task.CompletedTask;
}

protected override Task FixAllAsync(
protected override async Task FixAllAsync(
Document document,
ImmutableArray<Diagnostic> diagnostics,
SyntaxEditor editor,
Expand All @@ -45,7 +44,5 @@ protected override Task FixAllAsync(
typeDeclaration,
(current, generator) => generator.WithModifiers(current, generator.GetModifiers(current).WithIsReadOnly(true)));
}

return Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal sealed class ArrowExpressionClausePlacementCodeFixProvider() : CodeFixP
public override ImmutableArray<string> FixableDiagnosticIds
=> [IDEDiagnosticIds.ArrowExpressionClausePlacementDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var diagnostic = context.Diagnostics.First();
Expand All @@ -37,7 +37,6 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
c => UpdateDocumentAsync(document, [diagnostic], c),
nameof(CSharpCodeFixesResources.Place_token_on_following_line)),
context.Diagnostics);
return Task.CompletedTask;
}

private static async Task<Document> UpdateDocumentAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal sealed class ConditionalExpressionPlacementCodeFixProvider() : CodeFixP
public override ImmutableArray<string> FixableDiagnosticIds
=> [IDEDiagnosticIds.ConditionalExpressionPlacementDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var diagnostic = context.Diagnostics.First();
Expand All @@ -37,7 +37,6 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
c => UpdateDocumentAsync(document, [diagnostic], c),
nameof(CSharpCodeFixesResources.Place_token_on_following_line)),
context.Diagnostics);
return Task.CompletedTask;
}

private static async Task<Document> UpdateDocumentAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal sealed class ConsecutiveBracePlacementCodeFixProvider() : CodeFixProvid
public override ImmutableArray<string> FixableDiagnosticIds
=> [IDEDiagnosticIds.ConsecutiveBracePlacementDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var diagnostic = context.Diagnostics.First();
Expand All @@ -38,7 +38,6 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
c => UpdateDocumentAsync(document, diagnostic, c),
nameof(CSharpCodeFixesResources.Remove_blank_lines_between_braces)),
context.Diagnostics);
return Task.CompletedTask;
}

private static Task<Document> UpdateDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal sealed class ConstructorInitializerPlacementCodeFixProvider() : CodeFix
public override ImmutableArray<string> FixableDiagnosticIds
=> [IDEDiagnosticIds.ConstructorInitializerPlacementDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var diagnostic = context.Diagnostics.First();
Expand All @@ -37,7 +37,6 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
c => UpdateDocumentAsync(document, [diagnostic], c),
nameof(CSharpCodeFixesResources.Place_token_on_following_line)),
context.Diagnostics);
return Task.CompletedTask;
}

private static async Task<Document> UpdateDocumentAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal sealed class EmbeddedStatementPlacementCodeFixProvider() : CodeFixProvi
public override ImmutableArray<string> FixableDiagnosticIds
=> [IDEDiagnosticIds.EmbeddedStatementPlacementDiagnosticId];

public override Task RegisterCodeFixesAsync(CodeFixContext context)
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var diagnostic = context.Diagnostics.First();
Expand All @@ -40,7 +40,6 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
c => FixAllAsync(document, [diagnostic], c),
nameof(CSharpCodeFixesResources.Place_statement_on_following_line)),
context.Diagnostics);
return Task.CompletedTask;
}

public static async Task<Document> FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
Expand Down
Loading
Loading