提交 b63319d9 编写于 作者: J Johannes Rieken

support suffix/prefix label

上级 73164106
......@@ -26,6 +26,7 @@ import { FileKind } from 'vs/platform/files/common/files';
import { IModel } from 'vs/editor/common/editorCommon';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { Color } from 'vs/base/common/color';
import { localize } from 'vs/nls';
export interface IResourceLabel {
name: string;
......@@ -163,6 +164,7 @@ export class ResourceLabel extends IconLabel {
}
const resource = this.label.resource;
let label = this.label.name;
let title = '';
if (this.options && typeof this.options.title === 'string') {
......@@ -194,10 +196,28 @@ export class ResourceLabel extends IconLabel {
if (deco) {
color = this.themeService.getTheme().getColor(deco.color);
if (deco.tooltip) {
title = localize('deco.tooltip', "{0}, {1}", title, deco.tooltip);
}
if (deco.prefix) {
label += deco.prefix;
if (matches) {
matches.forEach(match => {
match.start += deco.prefix.length;
match.end += deco.prefix.length;
});
}
}
if (deco.suffix) {
label += deco.suffix;
}
}
}
this.setValue(this.label.name, this.label.description, {
this.setValue(label, this.label.description, {
title,
extraClasses,
italic,
......
......@@ -52,7 +52,8 @@ class SCMDecorationsProvider implements IDecorationsProvider {
return {
severity: Severity.Info,
color: resource.decorations.color,
tooltip: localize('tooltip', "{0}, {1}", resource.decorations.tooltip, this._provider.label),
suffix: '*',
tooltip: localize('tooltip', "{0} - {1}", resource.decorations.tooltip, this._provider.label),
icon: { light: resource.decorations.icon, dark: resource.decorations.iconDark }
};
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册