mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-07 17:44:05 -05:00
render source in front of message
This commit is contained in:
@@ -153,6 +153,10 @@ class ModelMarkerHandler {
|
||||
htmlMessage = [marker.message];
|
||||
}
|
||||
|
||||
if (marker.source) {
|
||||
htmlMessage.unshift({ isText: true, text: `[${marker.source}] ` });
|
||||
}
|
||||
|
||||
return {
|
||||
stickiness: EditorCommon.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
className,
|
||||
|
||||
@@ -24,7 +24,6 @@ import Modes = require('vs/editor/common/modes');
|
||||
import EditorBrowser = require('vs/editor/browser/editorBrowser');
|
||||
import HtmlContentRenderer = require('vs/base/browser/htmlContentRenderer');
|
||||
import {Emitter} from 'vs/base/common/event';
|
||||
import CodeEditorWidget = require('vs/editor/browser/widget/codeEditorWidget');
|
||||
import {Position} from 'vs/editor/common/core/position';
|
||||
import {IMarkerService, IMarker} from 'vs/platform/markers/common/markers';
|
||||
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -250,7 +249,11 @@ class MarkerNavigationWidget extends ZoneWidget.ZoneWidget {
|
||||
}
|
||||
|
||||
// update label and show
|
||||
this._element.text(strings.format('({0}/{1}) ', this._model.indexOf(marker) + 1, this._model.length()));
|
||||
let text = strings.format('({0}/{1}) ', this._model.indexOf(marker) + 1, this._model.length());
|
||||
if (marker.source) {
|
||||
text = `${text}[${marker.source}] `;
|
||||
}
|
||||
this._element.text(text);
|
||||
var htmlElem = this._element.getHTMLElement();
|
||||
HtmlContentRenderer.renderHtml2(marker.message).forEach((node) => {
|
||||
htmlElem.appendChild(node);
|
||||
@@ -348,7 +351,8 @@ class MarkerController implements EditorCommon.IEditorContribution {
|
||||
private _callOnClose: lifecycle.IDisposable[] = [];
|
||||
private _markersNavigationVisible: IKeybindingContextKey<boolean>;
|
||||
|
||||
constructor(editor:EditorBrowser.ICodeEditor, @IMarkerService markerService: IMarkerService, @IKeybindingService keybindingService: IKeybindingService,
|
||||
constructor(
|
||||
editor: EditorBrowser.ICodeEditor, @IMarkerService markerService: IMarkerService, @IKeybindingService keybindingService: IKeybindingService,
|
||||
@IEventService eventService: IEventService, @IEditorService editorService: IEditorService) {
|
||||
this.markerService = markerService;
|
||||
this.eventService = eventService;
|
||||
|
||||
@@ -129,6 +129,7 @@ function _asMarker(diagnostic: ts.Diagnostic, classifier: DiagnosticClassifier,
|
||||
markers.push({
|
||||
severity,
|
||||
message: ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'),
|
||||
source: 'JavaScript',
|
||||
code: diagnostic.code.toString(),
|
||||
startLineNumber: range.startLineNumber,
|
||||
startColumn: range.startColumn,
|
||||
|
||||
@@ -45,19 +45,23 @@ class MarkerEntry extends QuickOpenEntryItem {
|
||||
dom.clearNode(container);
|
||||
let elements: string[] = [];
|
||||
let {severity, message, source, resource, startLineNumber, startColumn} = this._marker;
|
||||
if (source) {
|
||||
message = `${message} (${source})`;
|
||||
}
|
||||
elements.push('<div class="inline">');
|
||||
elements.push(strings.format('<div class="severity {0}"></div>', Severity.toString(severity).toLowerCase()));
|
||||
elements.push('</div>');
|
||||
elements.push('<div class="inline entry">');
|
||||
elements.push('<div>');
|
||||
if (source) {
|
||||
elements.push(strings.format('<span class="source">[{0}] </span>', source))
|
||||
}
|
||||
elements.push(strings.format('<span class="message">{0}</span>', message));
|
||||
elements.push('</div>');
|
||||
elements.push('<div>');
|
||||
elements.push(strings.format('<span class="path"><span class="basename">{0} ({1},{2})</span><span class="dirname">{3}</span></span>',
|
||||
paths.basename(resource.fsPath), startLineNumber, startColumn, this._lp.getLabel(paths.dirname(resource.fsPath))
|
||||
elements.push(strings.format(
|
||||
'<span class="path"><span class="basename">{0} ({1},{2})</span><span class="dirname">{3}</span></span>',
|
||||
paths.basename(resource.fsPath),
|
||||
startLineNumber,
|
||||
startColumn,
|
||||
this._lp.getLabel(paths.dirname(resource.fsPath))
|
||||
));
|
||||
elements.push('</div>');
|
||||
elements.push('<div>');
|
||||
@@ -95,8 +99,7 @@ export class MarkersHandler extends QuickOpenHandler {
|
||||
constructor(
|
||||
@IMarkerService markerService: IMarkerService,
|
||||
@IEditorService editorService: IEditorService,
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService
|
||||
) {
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService) {
|
||||
super();
|
||||
|
||||
this._markerService = markerService;
|
||||
@@ -120,25 +123,33 @@ export class MarkersHandler extends QuickOpenHandler {
|
||||
private static _sort(a: IMarker, b: IMarker): number {
|
||||
let ret: number;
|
||||
|
||||
// 1st: severity matters first
|
||||
// severity matters first
|
||||
ret = Severity.compare(a.severity, b.severity);
|
||||
if (ret !== 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 2nd: file name matters for equal severity
|
||||
// source matters
|
||||
if (a.source && b.source) {
|
||||
ret = a.source.localeCompare(b.source);
|
||||
if (ret !== 0) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
// file name matters for equal severity
|
||||
ret = strings.localeCompare(a.resource.fsPath, b.resource.fsPath);
|
||||
if (ret !== 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 3rd: start line matters
|
||||
// start line matters
|
||||
ret = a.startLineNumber - b.startLineNumber;
|
||||
if (ret !== 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 4th: start column matters
|
||||
// start column matters
|
||||
ret = a.startColumn - b.startColumn;
|
||||
if (ret !== 0) {
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user