Skip to content

[fix] #27649 pin intellisense documentation widget to top#62115

Merged
ramya-rao-a merged 1 commit intomicrosoft:masterfrom
riltsken:fix-27649-pin-doc-widget-top
Dec 3, 2018
Merged

[fix] #27649 pin intellisense documentation widget to top#62115
ramya-rao-a merged 1 commit intomicrosoft:masterfrom
riltsken:fix-27649-pin-doc-widget-top

Conversation

@riltsken
Copy link
Contributor

Fixes: #27649

Long docs when cursor is near the bottom will jump to the top to allow for more space, but if the next suggestion docs are smaller it will jump back down creating a jarring experience when flipping through suggestions quickly. Pin the widget to the top if it flips to the top once so that the experience is more fluid.

This is just one way we might handle it. Open to suggestions as this is my first PR to VSCode.

@msftclas
Copy link

msftclas commented Oct 30, 2018

CLA assistant check
All CLA requirements met.

@riltsken riltsken force-pushed the fix-27649-pin-doc-widget-top branch from 8328061 to 8586c32 Compare October 30, 2018 04:31
@kieferrm kieferrm requested a review from ramya-rao-a November 2, 2018 18:24
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to call this.adjustDocsPosition again here? None of the constants declared above this if condition gets changed by this.preferDocPositionTop = true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will double check tomorrow when I have a moment, but if I remember correctly I believe it's because at this point it has now flipped back to the bottom so I am forcing it to rerender back to the top. I will verify though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To give context and explain a bit better I will outline the original behavior, without the adjustDocsPosition, and with the adjustDocsPosition

Original behavior
When opening intellisense documentation. Moving through each option with the arrow keys the documentation will swap up and down depending on the space creating the jarring experience.

Without adjustDocsPosition
When opening intellisense documentation. The first time the docs position swaps from the bottom to the top it will trigger the preferDocPositionTop flag so subsequent moves through the documentation suggestions will stick to the top after the first one triggered goes to the bottom.

With adjustDocsPosition
When opening intellisense documentation. The first time the docs position adjusts it will trigger the preferDocPositionTop flag but prevent any noticeable difference that it had swapped at all and just look like it was at the top the whole time.

This is because of this line right above which creates a side effect causing the documentation position to re-evaluate where things should go.

const cursorCoords = this.editor.getScrolledVisiblePosition(this.editor.getPosition());

Let me know if I can answer this question more clearly or differently to help. Thank you for looking and commenting!

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, why not exit after calling adjustDocsPosition?

ie. Replace the this.adjustDocsPosition() here with

this.docsPositionPreviousWidgetY = widgetY;
this.adjustDocsPosition();
return;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes makes sense :) I'll update and rebase.

@ramya-rao-a ramya-rao-a requested a review from jrieken November 19, 2018 04:04
@ramya-rao-a ramya-rao-a assigned jrieken and unassigned ramya-rao-a Nov 19, 2018
@riltsken riltsken force-pushed the fix-27649-pin-doc-widget-top branch from 8586c32 to 2619e9b Compare November 21, 2018 06:40
@jrieken jrieken assigned ramya-rao-a and unassigned jrieken Nov 21, 2018
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldnt we reset this.docsPositionPreviousWidgetY here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated :)

Fixes: microsoft#27649

Long docs when cursor is near the bottom will jump to the top to allow for more space, but if the next suggestion docs are smaller it will jump back down creating a jarring experience when flipping through suggestions quickly. Pin the widget to the top if it flips to the top once so that the experience is more fluid.

This is just one way we might handle it. Open to suggestions as this is my first PR to VSCode.
@riltsken riltsken force-pushed the fix-27649-pin-doc-widget-top branch from 2619e9b to 357fe9f Compare November 25, 2018 00:49
@jrieken jrieken removed their request for review November 26, 2018 08:14
@ramya-rao-a ramya-rao-a added this to the November 2018 milestone Dec 3, 2018
@ramya-rao-a ramya-rao-a merged commit 9e62a05 into microsoft:master Dec 3, 2018
@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.

Suggestion list jumps between below and above position

4 participants