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

add tooltip, prefix, and suffix text

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