Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not select target range going to definition #11691

Merged
merged 2 commits into from May 15, 2024

Conversation

Congyuwang
Copy link
Contributor

Release Notes:

-Fixed #11347 , do not select target range going to definition. Just place the cursor at the start of target range.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label May 11, 2024
@Congyuwang
Copy link
Contributor Author

Seems to me that when using VIM mode, only the first character got selected anyway. So that letting the cursor go to the beginning of the range of definition, seems more consistent across VIM and non-VIM mode.

@maxdeviant maxdeviant changed the title do not select target range going to definition Do not select target range going to definition May 11, 2024
@ConradIrwin ConradIrwin self-assigned this May 14, 2024
@ConradIrwin
Copy link
Collaborator

@Congyuwang thanks for this!

It seems like there's a few cases to consider:

I think this change will change the behavior in both of these cases; which might be ok, but I wonder if we should more narrowly special case this to just work-around the bug in rust analyzer. i.e. if the returned range is > 1 line, make it just highlight the first character, otherwise keep the selection?

Otherwise we could deliberately not highlight the definition when clicking on it, but it is kind of nice that that behavior matches search (even if it differs from vim).

What do you think?

@Congyuwang
Copy link
Contributor Author

I think that would be good.

@Congyuwang
Copy link
Contributor Author

It now works nicely!

@ConradIrwin ConradIrwin merged commit c3c4e37 into zed-industries:main May 15, 2024
8 checks passed
@Congyuwang Congyuwang deleted the no-selection-cmd-click branch May 15, 2024 15:47
@Congyuwang
Copy link
Contributor Author

Just noticed that the old release note is not very accurate.

@JosephTLyons
Copy link
Contributor

Just noticed that the old release note is not very accurate.

About to build the release notes for today's release - what are you thinking the release note for this item should be?

@Congyuwang
Copy link
Contributor Author

Maybe the following:

Release Notes:

-Fixed #11347 , Do not select target range going to definition when the range has more than one line.

osiewicz pushed a commit to RemcoSmitsDev/zed that referenced this pull request May 18, 2024
Release Notes:

-Fixed zed-industries#11347 , do not select target range going to definition. Just
place the cursor at the start of target range.
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.

Rust: jump to definition (Command click) should not enclose the target with a text selection
3 participants