Merge from vscode 52dcb723a39ae75bee1bd56b3312d7fcdc87aeed (#6719)

This commit is contained in:
Anthony Dresser
2019-08-12 21:31:51 -07:00
committed by GitHub
parent 00250839fc
commit 7eba8c4c03
616 changed files with 9472 additions and 7087 deletions

View File

@@ -51,7 +51,7 @@ const WIDGET_ID = 'vs.editor.contrib.zoneWidget';
export class ViewZoneDelegate implements IViewZone {
public domNode: HTMLElement;
public id: number;
public id: number = 0; // A valid zone id should be greater than 0
public afterLineNumber: number;
public afterColumn: number;
public heightInLines: number;
@@ -109,8 +109,8 @@ class Arrow {
private readonly _ruleName = Arrow._IdGenerator.nextId();
private _decorations: string[] = [];
private _color: string;
private _height: number;
private _color: string | null = null;
private _height: number = -1;
constructor(
private readonly _editor: ICodeEditor
@@ -159,15 +159,15 @@ class Arrow {
export abstract class ZoneWidget implements IHorizontalSashLayoutProvider {
private _arrow: Arrow;
private _overlayWidget: OverlayWidgetDelegate | null;
private _resizeSash: Sash;
private _arrow: Arrow | null = null;
private _overlayWidget: OverlayWidgetDelegate | null = null;
private _resizeSash: Sash | null = null;
private _positionMarkerId: string[] = [];
protected _viewZone: ViewZoneDelegate | null;
protected _viewZone: ViewZoneDelegate | null = null;
protected readonly _disposables = new DisposableStore();
public container: HTMLElement;
public container: HTMLElement | null = null;
public domNode: HTMLElement;
public editor: ICodeEditor;
public options: IOptions;
@@ -273,12 +273,16 @@ export abstract class ZoneWidget implements IHorizontalSashLayoutProvider {
private _onViewZoneHeight(height: number): void {
this.domNode.style.height = `${height}px`;
let containerHeight = height - this._decoratingElementsHeight();
this.container.style.height = `${containerHeight}px`;
const layoutInfo = this.editor.getLayoutInfo();
this._doLayout(containerHeight, this._getWidth(layoutInfo));
if (this.container) {
let containerHeight = height - this._decoratingElementsHeight();
this.container.style.height = `${containerHeight}px`;
const layoutInfo = this.editor.getLayoutInfo();
this._doLayout(containerHeight, this._getWidth(layoutInfo));
}
this._resizeSash.layout();
if (this._resizeSash) {
this._resizeSash.layout();
}
}
public get position(): Position | undefined {
@@ -373,7 +377,7 @@ export abstract class ZoneWidget implements IHorizontalSashLayoutProvider {
let frameThickness = 0;
// Render the arrow one 1/3 of an editor line height
if (this.options.showArrow) {
if (this._arrow && this.options.showArrow) {
arrowHeight = Math.round(lineHeight / 3);
this._arrow.height = arrowHeight;
this._arrow.show(position);
@@ -407,17 +411,19 @@ export abstract class ZoneWidget implements IHorizontalSashLayoutProvider {
this.editor.addOverlayWidget(this._overlayWidget);
});
if (this.options.showFrame) {
if (this.container && this.options.showFrame) {
const width = this.options.frameWidth ? this.options.frameWidth : frameThickness;
this.container.style.borderTopWidth = width + 'px';
this.container.style.borderBottomWidth = width + 'px';
}
let containerHeight = heightInLines * lineHeight - this._decoratingElementsHeight();
this.container.style.top = arrowHeight + 'px';
this.container.style.height = containerHeight + 'px';
this.container.style.overflow = 'hidden';
if (this.container) {
this.container.style.top = arrowHeight + 'px';
this.container.style.height = containerHeight + 'px';
this.container.style.overflow = 'hidden';
}
this._doLayout(containerHeight, width);
@@ -438,6 +444,10 @@ export abstract class ZoneWidget implements IHorizontalSashLayoutProvider {
}
protected setCssClass(className: string, classToReplace?: string): void {
if (!this.container) {
return;
}
if (classToReplace) {
this.container.classList.remove(classToReplace);
}