This commit is contained in:
Sandeep Somavarapu 2019-03-06 10:18:15 +01:00
parent 0b9e2a1c8a
commit ec878903e9

View file

@ -24,7 +24,7 @@ import { ContentHoverWidget } from 'vs/editor/contrib/hover/hoverWidgets';
import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer'; import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer';
import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IThemeService } from 'vs/platform/theme/common/themeService';
import { coalesce, isNonEmptyArray } from 'vs/base/common/arrays'; import { coalesce, isNonEmptyArray } from 'vs/base/common/arrays';
import { IMarker, IMarkerData } from 'vs/platform/markers/common/markers'; import { IMarker, IMarkerData, MarkerSeverity } from 'vs/platform/markers/common/markers';
import { basename } from 'vs/base/common/resources'; import { basename } from 'vs/base/common/resources';
import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService'; import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService';
import { onUnexpectedError } from 'vs/base/common/errors'; import { onUnexpectedError } from 'vs/base/common/errors';
@ -474,7 +474,8 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
if (markerMessages.length) { if (markerMessages.length) {
markerMessages.forEach(msg => fragment.appendChild(this.renderMarkerHover(msg))); markerMessages.forEach(msg => fragment.appendChild(this.renderMarkerHover(msg)));
fragment.appendChild(this.renderMarkerStatusbar(markerMessages[0])); const markerHoverForStatusbar = markerMessages.length === 1 ? markerMessages[0] : markerMessages.sort((a, b) => MarkerSeverity.compare(a.marker.severity, b.marker.severity))[0];
fragment.appendChild(this.renderMarkerStatusbar(markerHoverForStatusbar));
} }
// show // show
@ -550,15 +551,17 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
}); });
} }
})); }));
disposables.push(this.renderAction(actionsElement, { if (markerHover.marker.severity === MarkerSeverity.Error || markerHover.marker.severity === MarkerSeverity.Warning || markerHover.marker.severity === MarkerSeverity.Info) {
label: nls.localize('peek problem', "Peek Problem"), disposables.push(this.renderAction(actionsElement, {
commandId: NextMarkerAction.ID, label: nls.localize('peek problem', "Peek Problem"),
run: () => { commandId: NextMarkerAction.ID,
this.hide(); run: () => {
MarkerController.get(this._editor).show(markerHover.marker); this.hide();
this._editor.focus(); MarkerController.get(this._editor).show(markerHover.marker);
} this._editor.focus();
})); }
}));
}
this.renderDisposable = combinedDisposable(disposables); this.renderDisposable = combinedDisposable(disposables);
return hoverElement; return hoverElement;
} }