提交 9e5bd5fb 编写于 作者: J Johannes Rieken

add tooltip, prefix, and suffix text

上级 7921c1fe
......@@ -6,7 +6,7 @@
'use strict';
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions';
import { IMarkerService, IMarker } from 'vs/platform/markers/common/markers';
import { IMarkerService } from 'vs/platform/markers/common/markers';
import { IResourceDecorationsService, IDecorationsProvider, IResourceDecoration } from 'vs/workbench/services/decorations/browser/decorations';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import URI from 'vs/base/common/uri';
......@@ -34,15 +34,16 @@ class MarkersDecorationsProvider implements IDecorationsProvider {
const markers = this._markerService.read({ resource })
.sort((a, b) => Severity.compare(a.severity, b.severity));
return !isFalsyOrEmpty(markers)
? MarkersDecorationsProvider._toFileDecorationData(markers[0])
: undefined;
}
if (isFalsyOrEmpty(markers)) {
return undefined;
}
private static _toFileDecorationData(marker: IMarker): IResourceDecoration {
const { severity } = marker;
const color = severity === Severity.Error ? editorErrorForeground : editorWarningForeground;
return { severity, color };
const [first] = markers;
return {
severity: first.severity,
tooltip: markers.length > 1 ? localize('tooltip', "{0} and {1} more problems", first.message, markers.length) : first.message,
color: first.severity === Severity.Error ? editorErrorForeground : editorWarningForeground
};
}
}
......
......@@ -62,6 +62,7 @@ class SCMDecorationsProvider implements IDecorationsProvider {
return {
severity: Severity.Info,
color: resource.decorations.color,
tooltip: resource.decorations.tooltip,
icon: { light: resource.decorations.icon, dark: resource.decorations.iconDark }
};
}
......
......@@ -15,6 +15,9 @@ export const IResourceDecorationsService = createDecorator<IResourceDecorationsS
export interface IResourceDecoration {
readonly severity: Severity;
readonly tooltip?: string;
readonly prefix?: string;
readonly suffix?: string;
readonly color?: ColorIdentifier;
readonly icon?: URI | { dark: URI, light: URI };
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册