Skip to content

Commit

Permalink
Fixes #27610
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Jun 2, 2017
1 parent 874bb86 commit df1034a
Showing 1 changed file with 9 additions and 55 deletions.
64 changes: 9 additions & 55 deletions src/vs/editor/contrib/suggest/browser/suggestWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,8 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
show(this.details.element);
this.renderDetails();

// With docs showing up, list might need adjustments to keep it close to the cursor
this.adjustListPosition();
// Reset margin-top that was set as Fix for #26416
this.listElement.style.marginTop = '0px';

// with docs showing up widget width/height may change, so reposition the widget
this.editor.layoutContentWidget(this);
Expand Down Expand Up @@ -939,15 +939,13 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
removeClass(this.element, 'list-right');
}

if (cursorY > widgetY) {
if (!hasClass(this.element, 'widget-above')) {
addClass(this.element, 'widget-above');
// Since the widget was previously not above the cursor,
// the list needs to be adjusted to keep it close to the cursor
this.adjustListPosition();
}
} else {
removeClass(this.element, 'widget-above');
if (hasClass(this.element, 'docs-side')
&& cursorY > widgetY
&& this.details.element.offsetHeight > this.listElement.offsetHeight) {

// Fix for #26416
// Docs is bigger than list and widget is above cursor, apply margin-top so that list appears right above cursor
this.listElement.style.marginTop = `${this.details.element.offsetHeight - this.listElement.offsetHeight}px`;
}
}

Expand All @@ -962,50 +960,6 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
}
}

private adjustListPosition(): void {


if (hasClass(this.element, 'docs-side')) {

if (this.details.element.offsetHeight > this.listElement.offsetHeight) {

// Fix for #26416
// Docs is bigger than list and widget is above cursor, apply margin-top so that list appears right above cursor
if (hasClass(this.element, 'widget-above')) {
this.listElement.style.marginTop = `${this.details.element.offsetHeight - this.listElement.offsetHeight}px`;
}

// Fix for #26244
// if (hasClass(this.element, 'list-right')) {
// addClass(this.listElement, 'empty-left-border');
// removeClass(this.listElement, 'empty-right-border');
// } else {
// addClass(this.listElement, 'empty-right-border');
// removeClass(this.listElement, 'empty-left-border');
// }

// removeClass(this.details.element, 'empty-left-border');
// removeClass(this.details.element, 'empty-right-border');
return;
} else {
// Fix for #26244
// if (hasClass(this.element, 'list-right')) {
// addClass(this.details.element, 'empty-right-border');
// removeClass(this.details.element, 'empty-left-border');
// } else {
// addClass(this.details.element, 'empty-left-border');
// removeClass(this.details.element, 'empty-right-border');
// }

// removeClass(this.listElement, 'empty-right-border');
// removeClass(this.listElement, 'empty-left-border');
}
}

// Reset margin-top that was set as Fix for #26416
this.listElement.style.marginTop = '0px';
}

private renderDetails(): void {
if (this.state === State.Details || this.state === State.Open) {
this.details.render(this.list.getFocusedElements()[0]);
Expand Down

0 comments on commit df1034a

Please sign in to comment.