VS Code: QuickPick disambiguation for ambiguous F16 rename targets#27
Open
clrudolphi wants to merge 2 commits into
Open
VS Code: QuickPick disambiguation for ambiguous F16 rename targets#27clrudolphi wants to merge 2 commits into
clrudolphi wants to merge 2 commits into
Conversation
VS Code's prepareRename previously returned null for a step whose text matches multiple binding attributes, silently suppressing rename with no explanation -- unlike the Visual Studio client, which already shows a disambiguation dialog for the same case via the reqnroll/renameTargets and reqnroll/selectRenameTarget custom requests. That server-side plumbing is already generic (not VS-specific), so this adds a VS Code-idiomatic equivalent purely on the client: a RenameMiddleware override intercepts textDocument/prepareRename, queries reqnroll/renameTargets, and when more than one binding matches, shows a QuickPick and sends reqnroll/selectRenameTarget with the user's choice before delegating to the standard rename flow. Zero/one-target cases pass straight through to VS Code's native prepareRename, so normal rename UX is unchanged. Closes #10
2 tasks
CI's format:check step failed on this new test file.
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
prepareRenamepreviously returnednullwhenever the cursor's step text matched more than one step-binding attribute, silently suppressing rename with no explanation to the user.reqnroll/renameTargets(enumerate candidates) andreqnroll/selectRenameTarget(record the user's pick for the nexttextDocument/rename) custom requests — this plumbing is generic, not VS-specific.RenameMiddleware.prepareRenameoverride (src/VSCode/src/renameDisambiguation.ts) that queriesreqnroll/renameTargetsfirst. When 0 or 1 candidates are returned, it delegates straight through to VS Code's nativeprepareRename(no behavior change). When 2+ candidates are returned, it shows avscode.window.showQuickPicklisting the ambiguous binding attributes, sendsreqnroll/selectRenameTargetwith the chosen index (usingversion: 0, matching how the Visual Studio client and the server'sRenameSessionManagerkey sessions), and then proceeds with the normal rename flow so VS Code's native rename input box still opens.Test plan
npm run compilepasses cleanlynpm run lintpasses cleanlynpm test(real Extension Development Host run via@vscode/test-electron) — 23 passing, 1 pending (documents that driving the interactive QuickPick itself isn't automatable headlessly; the dismiss-picker and pass-through branches are covered)Reqnroll.IdeSupport.LSP.Server) code touched, so no LSP spec regression risk.csfile with two[Given]/[When]/[Then]attributes on the same method (or two bindings resolving to the same feature step), invoke rename (F2 or the "Rename Step" command), confirm the QuickPick lists both attributes, and confirm choosing one renames only that binding while dismissing the picker cancels rename cleanly.Closes #10