Distinguish ambiguous steps from "not found" in step rename#38
Open
clrudolphi wants to merge 1 commit into
Open
Distinguish ambiguous steps from "not found" in step rename#38clrudolphi wants to merge 1 commit into
clrudolphi wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reqnroll/renameTargetsnow reportsisAmbiguous, andRenameStepCommandshows "Reqnroll: Rename is not supported for an ambiguously bound step." instead.InvalidOperationExceptionstack trace via the generic "Rename is not available at this position." path.textDocument/prepareRenamenow throws a distinct, deliberately worded error for the ambiguous case.Root cause
Both symptoms trace back to one spot:
StepRenameHandler.FindBindingsAtFeatureStepskipped ambiguous steps (Result.HasAmbiguous, no singleHasDefinedmatch) 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 consumesrenameTargets).The fix threads an
isAmbiguousout-flag throughFindBindingsAtFeatureStepso callers can tell the two cases apart:HandleRenameTargetsFromFeatureAsyncsetsRenameTargetsResponse.IsAmbiguous, consumed by the VS extension'sRenameStepService.MapTargets→RenameStepCommand.HandlePrepareRenameAsync's.featurebranch 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 ambiguousMapTargetsshape)🤖 Generated with Claude Code