mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-29 17:41:32 +01:00
cleaning the code
This commit is contained in:
@@ -471,6 +471,7 @@ export class ContentHoverWidget extends ResizableContentWidget {
|
||||
private static _lastDimensions: dom.Dimension = new dom.Dimension(0, 0);
|
||||
|
||||
private _visibleData: ContentHoverVisibleData | undefined;
|
||||
private _position: Position | undefined;
|
||||
private _positionPreference: ContentWidgetPositionPreference | undefined;
|
||||
|
||||
private readonly _hover: HoverWidget = this._register(new HoverWidget());
|
||||
@@ -726,17 +727,13 @@ export class ContentHoverWidget extends ResizableContentWidget {
|
||||
}
|
||||
|
||||
public showAt(node: DocumentFragment, hoverData: ContentHoverVisibleData): void {
|
||||
|
||||
console.log('inside of showAt');
|
||||
|
||||
if (!this._editor || !this._editor.hasModel()) {
|
||||
return;
|
||||
}
|
||||
this._render(node, hoverData);
|
||||
const widgetHeight = dom.getTotalHeight(this._hover.containerDomNode);
|
||||
const widgetPosition = hoverData.showAtPosition;
|
||||
this._positionPreference = this._findPositionPreference(widgetHeight, widgetPosition) ?? ContentWidgetPositionPreference.ABOVE;
|
||||
console.log('this._positionPreference : ', this._positionPreference);
|
||||
this._position = hoverData.showAtPosition;
|
||||
this._positionPreference = this._findPositionPreference(widgetHeight, this._position) ?? ContentWidgetPositionPreference.ABOVE;
|
||||
|
||||
// See https://github.com/microsoft/vscode/issues/140339
|
||||
// TODO: Doing a second layout of the hover after force rendering the editor
|
||||
@@ -795,6 +792,10 @@ export class ContentHoverWidget extends ResizableContentWidget {
|
||||
this._adjustContentsBottomPadding();
|
||||
this._adjustHoverHeightForScrollbar(height);
|
||||
}
|
||||
if (this._position) {
|
||||
const widgetHeight = dom.getTotalHeight(this._hover.containerDomNode);
|
||||
this._positionPreference = this._findPositionPreference(widgetHeight, this._position);
|
||||
}
|
||||
this._layoutContentWidget();
|
||||
}
|
||||
|
||||
|
||||
@@ -86,11 +86,8 @@ export abstract class ResizableContentWidget extends Disposable implements ICont
|
||||
protected _findPositionPreference(widgetHeight: number, showAtPosition: IPosition): ContentWidgetPositionPreference | undefined {
|
||||
const maxHeightBelow = Math.min(this._availableVerticalSpaceBelow(showAtPosition) ?? Infinity, widgetHeight);
|
||||
const maxHeightAbove = Math.min(this._availableVerticalSpaceAbove(showAtPosition) ?? Infinity, widgetHeight);
|
||||
console.log('maxHeightBelow : ', maxHeightBelow);
|
||||
console.log('maxHeightAbove : ', maxHeightAbove);
|
||||
const maxHeight = Math.min(Math.max(maxHeightAbove, maxHeightBelow), widgetHeight);
|
||||
const height = Math.min(widgetHeight, maxHeight);
|
||||
console.log('height : ', height);
|
||||
let renderingAbove: ContentWidgetPositionPreference;
|
||||
if (this._editor.getOption(EditorOption.hover).above) {
|
||||
renderingAbove = height <= maxHeightAbove ? ContentWidgetPositionPreference.ABOVE : ContentWidgetPositionPreference.BELOW;
|
||||
|
||||
Reference in New Issue
Block a user