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

Reveal closer to top (center body, not signature) #80727

Merged
merged 7 commits into from
Feb 5, 2020

Conversation

wkornewald
Copy link
Contributor

This improves the jump to definition and outline UX esp. for long functions/classes.

Fixes #80726 (see issue description for reasoning behind this PR).

Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot be implemented by changing the behavior of VerticalRevealType.Center and VerticalRevealType.CenterIfOutsideViewport. These are well established and used by various places inside VS Code, and by extensions, e.g. the vim extension makes use of the revealLine command which accepts as argument "at": "center".

This could be implemented by adding a new kind of VerticalRevealType in the editor and adopting this new kind for the desired features (go to definition, etc.)

@wkornewald wkornewald force-pushed the reveal-closer-to-top branch 2 times, most recently from 28113cb to ab3692a Compare September 14, 2019 13:27
@wkornewald
Copy link
Contributor Author

This needs some testing whether the UX really is better in all cases. I had to make quite a few changes and I removed the IfOutsideViewport part to also behave more like the JetBrains IDEs. They always jump to the same (consistent) screen location.

Only the history navigation is different because JetBrains remembers the scroll position of each history entry. If you resize the window it always scrolls like with go to definition. I think VS Code should remember the scroll position, too, but I didn't look into that as part of this PR.

Very small viewports (e.g. when pressing SHIFT+F12) needed some tuning, so you can see enough preceding lines. The code ensures a minimum scroll position of 100px from the top.

What do you think?

@alexdima
Copy link
Member

@wkornewald I am sorry, but I cannot accept a PR that changes the world, because I cannot estimate its impact. That was really the point of my first review. Can you please make a change that is limited to go to definition or outline? Pick one, and let's tweak that one. If we receive positive feedback (I can also take the change to VSCode's UX call), we can then expand it to the entire universe of reveal calls... but I cannot accept such a huge PR because I cannot take responsibility for such a large impact change.

This scrolls the target closer to the top,
but leaves sufficient room for e.g. class/function comments,
while showing more of the source below the target
(i.e.. more of the class/function body).
@wkornewald
Copy link
Contributor Author

@alexandrudima I see, then let's give outline a try. The change is split into one commit for the infrastructure and one for the actual outline behavior change. I hope that's easier to review and simplifies testing individual aspects.

@wkornewald wkornewald requested a review from alexdima September 30, 2019 10:04
@alexdima alexdima added this to the October 2019 milestone Oct 2, 2019
@jrieken jrieken removed their assignment Oct 7, 2019
@alexdima alexdima modified the milestones: October 2019, November 2019 Oct 30, 2019
@alexdima alexdima modified the milestones: November 2019, January 2020 Jan 6, 2020
@alexdima alexdima modified the milestones: January 2020, February 2020 Feb 5, 2020
@alexdima alexdima removed the request for review from rebornix February 5, 2020 11:45
@alexdima
Copy link
Member

alexdima commented Feb 5, 2020

Thank you!

@alexdima
Copy link
Member

alexdima commented Feb 5, 2020

I have created #90068 to track the further adoption of this reveal type for other actions.

@wkornewald
Copy link
Contributor Author

Thank you, that's great news.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reveal closer to top instead of center: outline, go to definition, etc.
3 participants