Skip to content

Conversation

@shaik-zeeshan
Copy link
Contributor

Closes #42596

fixes vim going into visual mode whenever the goto definition action is done

Release Notes:

  • N/A

@cla-bot
Copy link

cla-bot bot commented Nov 14, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @shaik-zeeshan on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@shaik-zeeshan
Copy link
Contributor Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Nov 14, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @shaik-zeeshan on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Nov 14, 2025

The cla-bot has been summoned, and re-checked this pull request!

@shaik-zeeshan
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 14, 2025
@cla-bot
Copy link

cla-bot bot commented Nov 14, 2025

The cla-bot has been summoned, and re-checked this pull request!

@shaik-zeeshan shaik-zeeshan changed the title vim: fixes the goto definition action in vim where it goes into visual mode vim: Fixes the goto definition action in vim where it goes into visual mode Nov 14, 2025
@maxdeviant maxdeviant changed the title vim: Fixes the goto definition action in vim where it goes into visual mode vim: Fix the goto definition action in vim where it goes into visual mode Nov 14, 2025
@zelenenka zelenenka removed the request for review from ConradIrwin November 17, 2025 12:07
@dinocosta
Copy link
Contributor

Thank you for opening this Pull Request @shaik-zeeshan ! I'm having a hard-time trying to consistently reproduce the issue, as outlined in this comment, so will hold off on reviewing for now until I find the cause 🔍

@terids
Copy link

terids commented Nov 17, 2025

@dinocosta I can reproduce the issue 100% when working with C, but not with Swift. Might be language specific.

Revert the original changes done to fix the issue with `g d` in vim mode
updating the mode to Visual.

After looking into this it appears this was accidentally changed in
zed-industries#41583 with the removal of the
`collapse_matches` field from the `Editor`, which would be provided to
the `range_for_match` method and, in the case where vim mode was
enabled, it was `true`, avoiding the change to visual mode when jumping
to definition.

This commit updates the `Editor.navigate_to_hover_links` method in order
to check if vim mode is enabled, in which case it now collapses the
range, otherwise it won't, returning to the previous behavior.
@dinocosta
Copy link
Contributor

Hey @shaik-zeeshan 👋

I ended up pushing a commit changing the fix to where I believe the original logic resided, as it seems this was accidentally changed in #41583 .

@HactarCE If available, can you double-check if my commit looks good to you? I'm not super familiar with the motive behind removing Editor.collapse_matches, thanks! 🙇

@ConradIrwin
Copy link
Member

Thanks again! For now I've reverted #41583 in #42892, and we should re-land that in a less intrusive way. I've cherry-picked this to preview so it should go out to stable on Wednesday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vim Mode: "go to definition" will switch to visual mode

4 participants