Skip to content

Commit 4bab4dd

Browse files
committed
No need to check for multipoint selection
1 parent 842b162 commit 4bab4dd

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ public Task<ImmutableArray<RazorVSInternalCodeAction>> ProvideAsync(RazorCodeAct
6666

6767
var actionParams = CreateInitialActionParams(context, startElementNode, @namespace);
6868

69-
if (IsMultiPointSelection(context.Request.Range))
70-
{
71-
ProcessMultiPointSelection(startElementNode, endElementNode, actionParams);
72-
}
69+
ProcessSelection(startElementNode, endElementNode, actionParams);
7370

7471
var resolutionParams = new RazorCodeActionResolutionParams()
7572
{
@@ -160,7 +157,7 @@ private static ExtractToNewComponentCodeActionParams CreateInitialActionParams(R
160157
/// <param name="startElementNode">The starting element of the selection.</param>
161158
/// <param name="endElementNode">The ending element of the selection, if it exists.</param>
162159
/// <param name="actionParams">The parameters for the extraction action, which will be updated.</param>
163-
private static void ProcessMultiPointSelection(MarkupElementSyntax startElementNode, MarkupElementSyntax? endElementNode, ExtractToNewComponentCodeActionParams actionParams)
160+
private static void ProcessSelection(MarkupElementSyntax startElementNode, MarkupElementSyntax? endElementNode, ExtractToNewComponentCodeActionParams actionParams)
164161
{
165162
// If there's no end element, we can't process a multi-point selection
166163
if (endElementNode is null)
@@ -203,8 +200,6 @@ private static void ProcessMultiPointSelection(MarkupElementSyntax startElementN
203200
// Note: If we don't find a valid pair, we keep the original extraction range
204201
}
205202

206-
private static bool IsMultiPointSelection(Range range) => range.Start != range.End;
207-
208203
private static SourceLocation? GetEndLocation(Position selectionEnd, RazorCodeDocument codeDocument)
209204
{
210205
if (!codeDocument.Source.Text.TryGetSourceLocation(selectionEnd, out var location))

0 commit comments

Comments
 (0)