提交 24b9f788 编写于 作者: M Martin Aeschlimann

F8 Code Action Rendering. fixes #9299

上级 4eed1661
......@@ -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');
......
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册