Skip to content

Distinguish ambiguous steps from "not found" in step rename#38

Open
clrudolphi wants to merge 1 commit into
masterfrom
fix/ambiguous-step-rename-messaging
Open

Distinguish ambiguous steps from "not found" in step rename#38
clrudolphi wants to merge 1 commit into
masterfrom
fix/ambiguous-step-rename-messaging

Conversation

@clrudolphi

Copy link
Copy Markdown
Collaborator

Summary

Root cause

Both symptoms trace back to one spot: StepRenameHandler.FindBindingsAtFeatureStep skipped ambiguous steps (Result.HasAmbiguous, no single HasDefined match) before checking whether the cursor was even on that step, so an ambiguous step looked identical to "nothing matched here" to every caller (prepareRename, renameTargets, and the VS command that consumes renameTargets).

The fix threads an isAmbiguous out-flag through FindBindingsAtFeatureStep so callers can tell the two cases apart:

  • HandleRenameTargetsFromFeatureAsync sets RenameTargetsResponse.IsAmbiguous, consumed by the VS extension's RenameStepService.MapTargetsRenameStepCommand.
  • HandlePrepareRenameAsync's .feature branch throws a specific message for the ambiguous case instead of falling through to the generic "not found" null.

Test plan

  • dotnet test tests/LSP/Reqnroll.IdeSupport.LSP.Server.Tests — 521 passed (added 2 new cases covering ambiguous prepareRename/renameTargets)
  • dotnet test tests/VisualStudio/Reqnroll.VisualStudio.Tests — 80 passed (added 1 new case covering the ambiguous MapTargets shape)

🤖 Generated with Claude Code

FindBindingsAtFeatureStep skipped ambiguous steps (HasAmbiguous, no
single HasDefined match) before ever checking cursor position, so both
the VS "Rename Step" command and VS Code's native F2 saw an ambiguous
step as if nothing were found at all.

- reqnroll/renameTargets now reports IsAmbiguous so RenameStepCommand
  can show "Rename is not supported for an ambiguously bound step."
  instead of the misleading "No step definition found" (#34).
- textDocument/prepareRename now throws a distinct, deliberately worded
  error for the ambiguous case instead of the generic "not available"
  message (#36).

Fixes #34, Fixes #36

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VS Code: F2 on an ambiguous step shows a raw internal-error stack trace VS: Rename Step on an ambiguous step shows misleading status bar error

1 participant