Skip to content

Commit

Permalink
No need to check for multipoint selection
Browse files Browse the repository at this point in the history
  • Loading branch information
marcarro committed Aug 21, 2024
1 parent 842b162 commit 4bab4dd
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ public Task<ImmutableArray<RazorVSInternalCodeAction>> ProvideAsync(RazorCodeAct

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

if (IsMultiPointSelection(context.Request.Range))
{
ProcessMultiPointSelection(startElementNode, endElementNode, actionParams);
}
ProcessSelection(startElementNode, endElementNode, actionParams);

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

private static bool IsMultiPointSelection(Range range) => range.Start != range.End;

private static SourceLocation? GetEndLocation(Position selectionEnd, RazorCodeDocument codeDocument)
{
if (!codeDocument.Source.Text.TryGetSourceLocation(selectionEnd, out var location))
Expand Down

0 comments on commit 4bab4dd

Please sign in to comment.