mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 15:59:48 +00:00
Renamed code fix & use it also for local consts
This commit is contained in:
parent
6897e73035
commit
92d1b3ceed
@ -13,10 +13,10 @@ using Microsoft.CodeAnalysis.Rename;
|
|||||||
|
|
||||||
namespace SourceCodeRules.NamingCodeFixes;
|
namespace SourceCodeRules.NamingCodeFixes;
|
||||||
|
|
||||||
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(ConstStaticCodeFixProvider)), Shared]
|
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(ConvertToUpperCodeFixProvider)), Shared]
|
||||||
public sealed class ConstStaticCodeFixProvider : CodeFixProvider
|
public sealed class ConvertToUpperCodeFixProvider : CodeFixProvider
|
||||||
{
|
{
|
||||||
public override ImmutableArray<string> FixableDiagnosticIds => [Identifier.CONST_STATIC_ANALYZER];
|
public override ImmutableArray<string> FixableDiagnosticIds => [Identifier.CONST_STATIC_ANALYZER, Identifier.LOCAL_CONSTANTS_ANALYZER];
|
||||||
|
|
||||||
public override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;
|
public override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ public sealed class ConstStaticCodeFixProvider : CodeFixProvider
|
|||||||
if (declaration is null)
|
if (declaration is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context.RegisterCodeFix(CodeAction.Create(title: "Convert to UPPER_CASE", createChangedDocument: c => this.ConvertToUpperCaseAsync(context.Document, declaration, c), equivalenceKey: nameof(ConstStaticCodeFixProvider)), diagnostic);
|
context.RegisterCodeFix(CodeAction.Create(title: "Convert to UPPER_CASE", createChangedDocument: c => this.ConvertToUpperCaseAsync(context.Document, declaration, c), equivalenceKey: nameof(ConvertToUpperCodeFixProvider)), diagnostic);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Document> ConvertToUpperCaseAsync(Document document, VariableDeclaratorSyntax declarator, CancellationToken cancellationToken)
|
private async Task<Document> ConvertToUpperCaseAsync(Document document, VariableDeclaratorSyntax declarator, CancellationToken cancellationToken)
|
Loading…
Reference in New Issue
Block a user