feat(lsp): show jump target picker when multiple definitions are found - #3098
Conversation
|
|
Thanks @MatrixNeoKozak for contributing this! Could you also attach a screenshot of the current UI changes to the PR? For this workflow, a ModalBar isn't quite the UX we were intending. When a user Ctrl-clicks to jump to a definition, or invokes it using the Ctrl+J keyboard shortcut, showing the choices in a bar at the top of the editor means the user may have to move their attention and mouse all the way to the top to select a target. It also makes the flow less natural for users who started the action entirely from the keyboard. A better approach would be to show a Code Hints-style dropdown near the current cursor position, listing the possible jump targets along with a short description/context for each one. This would keep the interaction close to where the user is working and, importantly, the existing Code Hints dropdown is already designed to be keyboard-accessible, so users should be able to navigate and select a target without leaving the keyboard. Thanks again for working on this! |



What
Fixes #3093: When an LSP server resolves a position to multiple definitions (e.g.
obj.sayHello()whereobjcan be one of several classes overriding the method, including the base class), the old code silently jumped to the LAST entry (msgObj[msgObj.length - 1]), which is arbitrary and confusing.Now, when more than one jump point is returned:
file:line:colbutton (jQuery.text()is used, so labels are HTML-safe).The jump logic was factored into a shared
jumpToLocationhelper so the picker path and the single-result path stay identical. The picker prompt is added tosrc/nls/root/strings.jsfor translation.Why
This change resolves the target issue or improvement.
How to test
Verify that the project builds/runs correctly and the specific bug/improvement is addressed.
Fixes #3093