`cmd+click` symbol definition to find all references does not work in vim mode
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
When "vim_mode": true, cmd + click only GoToDefinition but does not FindAllReference when clicking on def (in INSERT or NORMAL mode).
If vim mode is disabled, however, the bidirectional cmd + click works properly.
https://github.com/zed-industries/zed/assets/52687642/22a71a2c-eb77-4804-a1ec-254e05e176fc
__
Environment
Zed: v0.131.1 (Zed Preview) OS: macOS 14.4.1 Memory: 16 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
Bidirectional cmd + click should work also in vim mode. Related #9259 .
If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.
No response
I wonder whether this is reproducible by others?
Yeah, I can reproduce it.
I investigated the code. The current implementation: after cmd+clicking, if definition is found, check whether the selected definition range covers where the cursor previously was before the definition is revealed (if definition is not revealed elsewhere, it is revealed right here, so I am clicking right on the definition, so let's do FindAllReference).
https://github.com/zed-industries/zed/blob/c81eb419d44ec141956f6132c2f61723641c490d/crates/editor/src/hover_links.rs#L215-L253
This is working fine when vim mode is false. However, when vim mode is enabled, let selection_after_revealing = editor.selections.newest::<Point>(cx); does not select the whole definition range, but only the first character of the definition, which does not overlap with the old cursor position, and so revealed_elsewhere = ! before_intersects_after_range is now true, and FindAllReference is not performed.
Should vim go to VISUAL mode when jumping to definition?
Should vim go to VISUAL mode when jumping to definition?
Hmmm, I'm not sure but that sounds wrong. I wonder whether we could change the check to say that if vim mode { if current_cursor already within the range of the definition } or something like that.