From 55c51a3a9d0218c9983d01a68ad9a20fdaf5075f Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 2 Sep 2024 15:34:32 +1000 Subject: [PATCH] Apply suggestions from code review --- .../Formatting/RazorFormattingService.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 99d63fe9d3..c5f28c682c 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -199,21 +199,16 @@ internal class RazorFormattingService : IRazorFormattingService public bool TryGetOnTypeFormattingTriggerKind(RazorCodeDocument codeDocument, int hostDocumentIndex, string triggerCharacter, out RazorLanguageKind triggerCharacterKind) { triggerCharacterKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); - if (triggerCharacterKind is not (RazorLanguageKind.CSharp or RazorLanguageKind.Html)) - { - return false; - } - - if (triggerCharacterKind == RazorLanguageKind.CSharp) + if (triggerCharacterKind is RazorLanguageKind.CSharp) { return s_csharpTriggerCharacterSet.Contains(triggerCharacter); } - else if (triggerCharacterKind == RazorLanguageKind.Html) + else if (triggerCharacterKind is RazorLanguageKind.Html) { return s_htmlTriggerCharacterSet.Contains(triggerCharacter); } - return true; + return false; } private async Task ApplyFormattedEditsAsync(