提交 de731d6b 编写于 作者: I Isidor Nikolic 提交者: GitHub

Merge pull request #21296 from michelkaporin/exception-widget

Exception widget resizing
......@@ -10,6 +10,7 @@ import { ZoneWidget } from 'vs/editor/contrib/zoneWidget/browser/zoneWidget';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IDebugService } from 'vs/workbench/parts/debug/common/debug';
import { RunOnceScheduler } from 'vs/base/common/async';
const $ = dom.$;
export class ExceptionWidget extends ZoneWidget {
......@@ -21,10 +22,16 @@ export class ExceptionWidget extends ZoneWidget {
super(editor, { showFrame: true, showArrow: true, frameWidth: 1 });
this.create();
const onDidLayoutChangeScheduler = new RunOnceScheduler(() => this._doLayout(undefined, undefined), 50);
this._disposables.add(this.editor.onDidLayoutChange(() => onDidLayoutChangeScheduler.schedule()));
}
protected _fillContainer(container: HTMLElement): void {
this.setCssClass('exception-widget');
// Set the font size and line height to the one from the editor configuration.
const fontInfo = this.editor.getConfiguration().fontInfo;
this.container.style.fontSize = `${fontInfo.fontSize}px`;
this.container.style.lineHeight = `${fontInfo.lineHeight}px`;
let title = $('.title');
title.textContent = nls.localize('exceptionThrown', 'Exception occured');
......@@ -37,4 +44,12 @@ export class ExceptionWidget extends ZoneWidget {
dom.append(container, msg);
}
}
protected _doLayout(heightInPixel: number, widthInPixel: number): void {
// Reload the height with respect to the exception text content and relayout it to match the line count.
this.container.style.height = 'initial';
const computedLinesNumber = Math.ceil(this.container.offsetHeight / this.editor.getConfiguration().fontInfo.lineHeight);
this._relayout(computedLinesNumber);
}
}
......@@ -332,7 +332,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
}
this.exceptionWidget = this.instantiationService.createInstance(ExceptionWidget, this.editor, lineNumber);
this.exceptionWidget.show({ lineNumber, column }, 3);
this.exceptionWidget.show({ lineNumber, column }, 0);
}
private closeExceptionWidget(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册