Skip to content

Commit dfa7d6d

Browse files
committed
nits and test fixes
1 parent ad22ca7 commit dfa7d6d

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToNewComponentCodeActionProvider.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,7 @@ private static void ProcessMultiPointSelection(MarkupElementSyntax startElementN
190190
}
191191
}
192192

193-
private static bool IsMultiPointSelection(Range range)
194-
{
195-
return range.Start != range.End;
196-
}
193+
private static bool IsMultiPointSelection(Range range) => range.Start != range.End;
197194

198195
private static SourceLocation? GetEndLocation(Position selectionEnd, RazorCodeDocument codeDocument, ILogger logger)
199196
{
@@ -234,14 +231,14 @@ private static (SyntaxNode? Start, SyntaxNode? End) FindContainingSiblingPair(Sy
234231
if (startContainingNode == null && childSpan.Contains(startSpan))
235232
{
236233
startContainingNode = child;
237-
if (endContainingNode != null)
234+
if (endContainingNode is not null)
238235
break; // Exit if we've found both
239236
}
240237

241238
if (childSpan.Contains(endSpan))
242239
{
243240
endContainingNode = child;
244-
if (startContainingNode != null)
241+
if (startContainingNode is not null)
245242
break; // Exit if we've found both
246243
}
247244
}
@@ -253,7 +250,7 @@ private static (SyntaxNode? Start, SyntaxNode? End) FindContainingSiblingPair(Sy
253250
{
254251
var current = node1;
255252

256-
while (current.Kind == SyntaxKind.MarkupElement && current != null)
253+
while (current.Kind == SyntaxKind.MarkupElement && current is not null)
257254
{
258255
if (current.Span.Contains(node2.Span))
259256
{

src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToNewComponentCodeActionProviderTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public async Task Handle_ValidElementSelection_ReturnsNotNull(string markupEleme
194194
var commandOrCodeActionContainer = await provider.ProvideAsync(context, default);
195195

196196
// Assert
197-
Assert.NotNull(commandOrCodeActionContainer);
197+
Assert.NotEmpty(commandOrCodeActionContainer);
198198
}
199199

200200
private static RazorCodeActionContext CreateRazorCodeActionContext(VSCodeActionParams request, SourceLocation location, string filePath, string text, bool supportsFileCreation = true)

0 commit comments

Comments
 (0)