Skip to content

editor.revealRange should ensure first line of range is always visible #45742

Closed

Description

@DanTup

Currently if you call editor.revealRange with a range that doesn't fit on the screen, it still centers the middle line. This means if it's a class/method/whatever you get a random chunk from the middle.

It should be possible (default, IMO, but at least an option) to always ensure the first line is in view, since it's almost always likely that the earlier lines in the range are more important to see than the middle lines (since the start of the range is likely the start of a declaration of something).

Activity

  1. DanTup commented on Mar 26, 2018

    @DanTup
    ContributorAuthor

    As a workaround, I figured I can call reveal again with the start of the range and using the Default reveal type:

    editor.revealRange(displayRange, vs.TextEditorRevealType.InCenterIfOutsideViewport);
    editor.revealRange(new vs.Range(displayRange.start, displayRange.start), vs.TextEditorRevealType.Default);
  2. roblourens commented on Oct 29, 2019

    @roblourens
    Member

    Verified by seeing that when I focus an item in the breadcrumbs that doesn't fit in the viewport, it shows me the top instead of the middle of that range. I assume that is verifying the right code here. That's a huge improvement, thanks!

  3. DanTup commented on Nov 25, 2019

    @DanTup
    ContributorAuthor

    Fix LGTM too, thanks!

  4. locked and limited conversation to collaborators on Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

editor-renderingEditor rendering issuesunder-discussionIssue is under discussion for relevance, priority, approachverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions