Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,10 @@ dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_compound_assignment = true:suggestion

# IDE0036: Order modifiers
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
dotnet_diagnostic.IDE0036.severity = warning

# CA1052: Static holder types should be Static or NotInheritable
dotnet_diagnostic.CA1052.severity = warning
3 changes: 3 additions & 0 deletions src/Compiler/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ dotnet_diagnostic.CA1018.severity = warning
# CA1047: Do not declare protected member in sealed type
dotnet_diagnostic.CA1047.severity = warning

# CA1052: Static holder types should be Static or NotInheritable
dotnet_diagnostic.CA1052.severity = warning

# CA1305: Specify IFormatProvider
dotnet_diagnostic.CA1305.severity = none

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public class DerivedViewComponentWithAmbiguity : AsyncViewComponentWithNonGeneri
public string Invoke() => null;
}

public class StaticInvokeAsyncViewComponent
public static class StaticInvokeAsyncViewComponent
{
public static Task<string> InvokeAsync() => null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests;

public class TestTagHelperDescriptors
public static class TestTagHelperDescriptors
{
public static TagHelperCollection SimpleTagHelperDescriptors
{
Expand Down
3 changes: 1 addition & 2 deletions src/Compiler/tools/RazorSyntaxGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@

using System;
using System.IO;
using System.Reflection;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

namespace RazorSyntaxGenerator;

public class Program
public static class Program
{
public static int Main(string[] args)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks;

internal static class Resources
{
private readonly static Dictionary<(string Name, string? Folder), string> s_textMap = new();
private readonly static Dictionary<(string Name, string? Folder), byte[]> s_bytesMap = new();
private static readonly Dictionary<(string Name, string? Folder), string> s_textMap = new();
private static readonly Dictionary<(string Name, string? Folder), byte[]> s_bytesMap = new();

private static string GetResourceName(string name, string? folder)
=> folder is not null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public ImmutableArray<Registration> GetRegistrations(VSInternalClientCapabilitie
protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(TextDocumentPositionParams request)
=> request.TextDocument.ToRazorTextDocumentIdentifier();

protected async override Task<LspHover?> HandleRequestAsync(TextDocumentPositionParams request, TextDocument razorDocument, CancellationToken cancellationToken)
protected override async Task<LspHover?> HandleRequestAsync(TextDocumentPositionParams request, TextDocument razorDocument, CancellationToken cancellationToken)
{
var position = LspFactory.CreatePosition(request.Position.ToLinePosition());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal class CohostInlayHintResolveEndpoint(
return data.TextDocument;
}

protected async override Task<InlayHint?> HandleRequestAsync(InlayHint request, TextDocument razorDocument, CancellationToken cancellationToken)
protected override async Task<InlayHint?> HandleRequestAsync(InlayHint request, TextDocument razorDocument, CancellationToken cancellationToken)
{
var razorData = GetInlayHintResolveData(request).AssumeNotNull();
var razorPosition = request.Position;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public ImmutableArray<Registration> GetRegistrations(VSInternalClientCapabilitie
protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(LinkedEditingRangeParams request)
=> request.TextDocument.ToRazorTextDocumentIdentifier();

protected async override Task<LinkedEditingRanges?> HandleRequestAsync(LinkedEditingRangeParams request, TextDocument razorDocument, CancellationToken cancellationToken)
protected override async Task<LinkedEditingRanges?> HandleRequestAsync(LinkedEditingRangeParams request, TextDocument razorDocument, CancellationToken cancellationToken)
{
var linkedRanges = await _remoteServiceInvoker.TryInvokeAsync<IRemoteLinkedEditingRangeService, LinePositionSpan[]?>(
razorDocument.Project.Solution,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ImmutableArray<Registration> GetRegistrations(VSInternalClientCapabilitie
protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(TextDocumentPositionParams request)
=> request.TextDocument.ToRazorTextDocumentIdentifier();

protected async override Task<SumType<LspLocation, LspLocation[], DocumentLink[]>?> HandleRequestAsync(TextDocumentPositionParams request, TextDocument razorDocument, CancellationToken cancellationToken)
protected override async Task<SumType<LspLocation, LspLocation[], DocumentLink[]>?> HandleRequestAsync(TextDocumentPositionParams request, TextDocument razorDocument, CancellationToken cancellationToken)
{
var position = LspFactory.CreatePosition(request.Position.ToLinePosition());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public ImmutableArray<Registration> GetRegistrations(VSInternalClientCapabilitie
protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(VSInternalDocumentOnAutoInsertParams request)
=> request.TextDocument.ToRazorTextDocumentIdentifier();

protected async override Task<VSInternalDocumentOnAutoInsertResponseItem?> HandleRequestAsync(VSInternalDocumentOnAutoInsertParams request, TextDocument razorDocument, CancellationToken cancellationToken)
protected override async Task<VSInternalDocumentOnAutoInsertResponseItem?> HandleRequestAsync(VSInternalDocumentOnAutoInsertParams request, TextDocument razorDocument, CancellationToken cancellationToken)
{
_logger.LogDebug($"Resolving auto-insertion for {razorDocument.FilePath}");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ImmutableArray<Registration> GetRegistrations(VSInternalClientCapabilitie
protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(SignatureHelpParams request)
=> request.TextDocument.ToRazorTextDocumentIdentifier();

protected async override Task<SignatureHelp?> HandleRequestAsync(SignatureHelpParams request, TextDocument razorDocument, CancellationToken cancellationToken)
protected override async Task<SignatureHelp?> HandleRequestAsync(SignatureHelpParams request, TextDocument razorDocument, CancellationToken cancellationToken)
{
// Return nothing if "Parameter Information" option is disabled unless signature help is invoked explicitly via command as opposed to typing or content change
if (request.Context is { TriggerKind: not SignatureHelpTriggerKind.Invoked } &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ namespace Microsoft.CodeAnalysis.Razor.CodeActions.Razor;

internal static class RazorCodeActionFactory
{
private readonly static Guid s_addComponentUsingTelemetryId = new("6c5416b7-7be7-49ee-aa60-904385be676f");
private readonly static Guid s_fullyQualifyComponentTelemetryId = new("3d9abe36-7d10-4e08-8c18-ad88baa9a923");
private readonly static Guid s_createComponentFromTagTelemetryId = new("a28e0baa-a4d5-4953-a817-1db586035841");
private readonly static Guid s_createExtractToCssTelemetryId = new("a3773518-35ff-455c-a8c2-d6adaf1d2c48");
private readonly static Guid s_createExtractToCodeBehindTelemetryId = new("f63167f7-fdc6-450f-8b7b-b240892f4a27");
private readonly static Guid s_createExtractToComponentTelemetryId = new("af67b0a3-f84b-4808-97a7-b53e85b22c64");
private readonly static Guid s_simplifyComponentTelemetryId = new("2207f68c-419e-4baa-8493-2e7769e5c91d");
private readonly static Guid s_generateEventHandlerTelemetryId = new("c14fa003-c752-45fc-bb29-3a123ae5ecef");
private readonly static Guid s_generateAsyncEventHandlerTelemetryId = new("9058ca47-98e2-4f11-bf7c-a16a444dd939");
private readonly static Guid s_promoteUsingDirectiveTelemetryId = new("751f9012-e37b-444a-9211-b4ebce91d96e");
private readonly static Guid s_removeUnnecessaryDirectivesTelemetryId = new("92bbd4a4-6076-4742-b90b-9b480e6a23ec");
private readonly static Guid s_wrapAttributesTelemetryId = new("1df50ba6-4ed1-40d8-8fe2-1c4c1b08e8b5");
private readonly static Guid s_simplifyFullyQualifiedComponentTelemetryId = new("f8640324-2037-49fd-9697-2227690c33c3");
private readonly static Guid s_sortAndConsolidateUsingsTelemetryId = new("a3dc8f52-7e1b-4a09-9c6d-2f5e7a8b3c01");
private static readonly Guid s_addComponentUsingTelemetryId = new("6c5416b7-7be7-49ee-aa60-904385be676f");
private static readonly Guid s_fullyQualifyComponentTelemetryId = new("3d9abe36-7d10-4e08-8c18-ad88baa9a923");
private static readonly Guid s_createComponentFromTagTelemetryId = new("a28e0baa-a4d5-4953-a817-1db586035841");
private static readonly Guid s_createExtractToCssTelemetryId = new("a3773518-35ff-455c-a8c2-d6adaf1d2c48");
private static readonly Guid s_createExtractToCodeBehindTelemetryId = new("f63167f7-fdc6-450f-8b7b-b240892f4a27");
private static readonly Guid s_createExtractToComponentTelemetryId = new("af67b0a3-f84b-4808-97a7-b53e85b22c64");
private static readonly Guid s_simplifyComponentTelemetryId = new("2207f68c-419e-4baa-8493-2e7769e5c91d");
private static readonly Guid s_generateEventHandlerTelemetryId = new("c14fa003-c752-45fc-bb29-3a123ae5ecef");
private static readonly Guid s_generateAsyncEventHandlerTelemetryId = new("9058ca47-98e2-4f11-bf7c-a16a444dd939");
private static readonly Guid s_promoteUsingDirectiveTelemetryId = new("751f9012-e37b-444a-9211-b4ebce91d96e");
private static readonly Guid s_removeUnnecessaryDirectivesTelemetryId = new("92bbd4a4-6076-4742-b90b-9b480e6a23ec");
private static readonly Guid s_wrapAttributesTelemetryId = new("1df50ba6-4ed1-40d8-8fe2-1c4c1b08e8b5");
private static readonly Guid s_simplifyFullyQualifiedComponentTelemetryId = new("f8640324-2037-49fd-9697-2227690c33c3");
private static readonly Guid s_sortAndConsolidateUsingsTelemetryId = new("a3dc8f52-7e1b-4a09-9c6d-2f5e7a8b3c01");

public static RazorVSInternalCodeAction CreateWrapAttributes(RazorCodeActionResolutionParams resolutionParams)
=> new RazorVSInternalCodeAction
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Workspace GetWorkspace()
/// </summary>
public static class TestAccessor
{
public async static Task<string?> InitializeRemoteExportProviderBuilderAsync(string localSettingsDirectory, TraceSource traceLogger, CancellationToken cancellationToken)
public static async Task<string?> InitializeRemoteExportProviderBuilderAsync(string localSettingsDirectory, TraceSource traceLogger, CancellationToken cancellationToken)
{
return await RemoteExportProviderBuilder.InitializeAsync(localSettingsDirectory, traceLogger, cancellationToken).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public override Task<IEnumerable<ReinvokeResponse<TOut>>> ReinvokeRequestOnMulti
return RequestMultipleServerCoreAsync<TIn, TOut>(method, parameters, cancellationToken);
}

public async override Task<ReinvokeResponse<TOut>> ReinvokeRequestOnServerAsync<TIn, TOut>(
public override async Task<ReinvokeResponse<TOut>> ReinvokeRequestOnServerAsync<TIn, TOut>(
string method,
string languageServerName,
TIn parameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ internal class InviolableEditTag : IInviolableEditTag
{
private InviolableEditTag() { }

public readonly static IInviolableEditTag Instance = new InviolableEditTag();
public static readonly IInviolableEditTag Instance = new InviolableEditTag();
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public override bool HasInterceptor(string methodName, string contentType)
return false;
}

public async override Task<TJsonToken?> ProcessGenericInterceptorsAsync<TJsonToken>(string methodName, TJsonToken message, string contentType, CancellationToken cancellationToken)
public override async Task<TJsonToken?> ProcessGenericInterceptorsAsync<TJsonToken>(string methodName, TJsonToken message, string contentType, CancellationToken cancellationToken)
where TJsonToken : default
{
_ = message ?? throw new ArgumentNullException(nameof(message));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public ImmutableArray<Registration> GetRegistrations(VSInternalClientCapabilitie
protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(VSInternalDocumentDiagnosticsParams request)
=> request.TextDocument?.ToRazorTextDocumentIdentifier();

protected async override Task<VSInternalDiagnosticReport[]?> HandleRequestAsync(VSInternalDocumentDiagnosticsParams request, TextDocument razorDocument, CancellationToken cancellationToken)
protected override async Task<VSInternalDiagnosticReport[]?> HandleRequestAsync(VSInternalDocumentDiagnosticsParams request, TextDocument razorDocument, CancellationToken cancellationToken)
{
if (request.QueryingDiagnosticKind?.Value == VSInternalDiagnosticKind.Task.Value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ internal static class SettingsNames
{
public const string UnifiedCollection = "languages.razor.advanced";

public static readonly string FormatOnType = UnifiedCollection + ".formatOnType";
public static readonly string AutoClosingTags = UnifiedCollection + ".autoClosingTags";
public static readonly string AutoInsertAttributeQuotes = UnifiedCollection + ".autoInsertAttributeQuotes";
public static readonly string ColorBackground = UnifiedCollection + ".colorBackground";
public static readonly string CodeBlockBraceOnNextLine = UnifiedCollection + ".codeBlockBraceOnNextLine";
public static readonly string AttributeIndentStyle = UnifiedCollection + ".attributeIndentStyle";
public static readonly string CommitElementsWithSpace = UnifiedCollection + ".commitElementsWithSpace";
public static readonly string Snippets = UnifiedCollection + ".snippets";
public static readonly string LogLevel = UnifiedCollection + ".logLevel";
public static readonly string FormatOnPaste = UnifiedCollection + ".formatOnPaste";
public const string FormatOnType = UnifiedCollection + ".formatOnType";
public const string AutoClosingTags = UnifiedCollection + ".autoClosingTags";
public const string AutoInsertAttributeQuotes = UnifiedCollection + ".autoInsertAttributeQuotes";
public const string ColorBackground = UnifiedCollection + ".colorBackground";
public const string CodeBlockBraceOnNextLine = UnifiedCollection + ".codeBlockBraceOnNextLine";
public const string AttributeIndentStyle = UnifiedCollection + ".attributeIndentStyle";
public const string CommitElementsWithSpace = UnifiedCollection + ".commitElementsWithSpace";
public const string Snippets = UnifiedCollection + ".snippets";
public const string LogLevel = UnifiedCollection + ".logLevel";
public const string FormatOnPaste = UnifiedCollection + ".formatOnPaste";

public static readonly string[] AllSettings =
[
Expand Down

This file was deleted.

Loading