diff --git a/src/vs/editor/contrib/gotoError/browser/gotoError.css b/src/vs/editor/contrib/gotoError/browser/gotoError.css index a6cbfa35c6f22428699247e29f7e0018064cc87b..a030719d0ae6a4bb6a32f0007f19f2d8c07a4586 100644 --- a/src/vs/editor/contrib/gotoError/browser/gotoError.css +++ b/src/vs/editor/contrib/gotoError/browser/gotoError.css @@ -34,10 +34,6 @@ white-space: pre-wrap; } -.monaco-editor .marker-widget .fixes { - position: absolute; - bottom: 0; -} .monaco-editor .marker-widget .fixes .quickfixhead { background-image: url('lightbulp.svg'); diff --git a/src/vs/editor/contrib/gotoError/browser/gotoError.ts b/src/vs/editor/contrib/gotoError/browser/gotoError.ts index ae5ac6e8e826dd31f615b33761adcf4b133bd93e..3943d95c8b4b2a590902018de8ae52a93346d889 100644 --- a/src/vs/editor/contrib/gotoError/browser/gotoError.ts +++ b/src/vs/editor/contrib/gotoError/browser/gotoError.ts @@ -12,7 +12,6 @@ import {Emitter} from 'vs/base/common/event'; import {CommonKeybindings, KeyCode, KeyMod} from 'vs/base/common/keyCodes'; import {IDisposable, dispose} from 'vs/base/common/lifecycle'; import Severity from 'vs/base/common/severity'; -import * as strings from 'vs/base/common/strings'; import URI from 'vs/base/common/uri'; import {TPromise} from 'vs/base/common/winjs.base'; import * as dom from 'vs/base/browser/dom'; @@ -309,6 +308,8 @@ class FixesWidget { class MarkerNavigationWidget extends ZoneWidget { + private _editor: ICodeEditor; + private _parentContainer: HTMLElement; private _container: HTMLElement; private _title: HTMLElement; private _messages: HTMLElement; @@ -317,16 +318,19 @@ class MarkerNavigationWidget extends ZoneWidget { constructor(editor: ICodeEditor, private _model: MarkerModel, private _commandService: ICommandService) { super(editor, { showArrow: true, showFrame: true, isAccessible: true }); + this._editor = editor; this.create(); this._wireModelAndView(); } protected _fillContainer(container: HTMLElement): void { - this._container = container; + this._parentContainer = container; + dom.addClass(container, 'marker-widget'); + this._parentContainer.tabIndex = 0; + this._parentContainer.setAttribute('role', 'tooltip'); - dom.addClass(this._container, 'marker-widget'); - this._container.tabIndex = 0; - this._container.setAttribute('role', 'tooltip'); + this._container = document.createElement('div'); + container.appendChild(this._container); this._title = document.createElement('div'); this._title.className = 'block title'; @@ -346,7 +350,7 @@ class MarkerNavigationWidget extends ZoneWidget { public show(where: editorCommon.IPosition, heightInLines: number): void { super.show(where, heightInLines); - this._container.focus(); + this._parentContainer.focus(); } private _wireModelAndView(): void { @@ -384,13 +388,18 @@ class MarkerNavigationWidget extends ZoneWidget { this._messages.appendChild(renderHtml(marker.message)); const range = Range.lift(marker); - const lines = strings.computeLineStarts(marker.message).length; - this._model.withoutWatchingEditorPosition(() => this.show(range.getStartPosition(), lines)); + this._model.withoutWatchingEditorPosition(() => this.show(range.getStartPosition(), this.computeRequiredHeight())); // check for fixes and update widget this._fixesWidget .update(getCodeActions(this.editor.getModel(), range)) - .then(() => this.show(range.getStartPosition(), lines + 2)); + .then(() => this.show(range.getStartPosition(), this.computeRequiredHeight())); + } + + private computeRequiredHeight() { + // minimum one line content, add one line for zone widget decorations + let lineHeight = this._editor.getConfiguration().lineHeight || 12; + return Math.max(1, Math.ceil(this._container.clientHeight / lineHeight)) + 1; } public dispose(): void {