decorations.ts 1.7 KB
Newer Older
1 2 3 4 5 6 7 8 9
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
'use strict';

import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import URI from 'vs/base/common/uri';
import Event from 'vs/base/common/event';
10
import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
11
import { IDisposable } from 'vs/base/common/lifecycle';
12

J
Johannes Rieken 已提交
13
export const IDecorationsService = createDecorator<IDecorationsService>('IFileDecorationsService');
14

J
Johannes Rieken 已提交
15
export interface IDecorationData {
16
	readonly weight?: number;
J
Johannes Rieken 已提交
17
	readonly color?: ColorIdentifier;
18
	readonly letter?: string;
J
Johannes Rieken 已提交
19
	readonly title?: string;
20
	readonly bubble?: boolean;
21
	readonly source?: string;
22
}
23

J
Johannes Rieken 已提交
24
export interface IDecoration {
25 26 27 28 29
	readonly title: string;
	readonly labelClassName: string;
	readonly badgeClassName: string;
	readonly data: IDecorationData[];
	update(replace: { source?: string, data?: IDecorationData }): IDecoration;
30 31
}

32 33 34
export interface IDecorationsProvider {
	readonly label: string;
	readonly onDidChange: Event<URI[]>;
J
Johannes Rieken 已提交
35
	provideDecorations(uri: URI): IDecorationData | Thenable<IDecorationData>;
36 37
}

38 39 40 41
export interface IResourceDecorationChangeEvent {
	affectsResource(uri: URI): boolean;
}

J
Johannes Rieken 已提交
42
export interface IDecorationsService {
43 44 45

	readonly _serviceBrand: any;

46
	readonly onDidChangeDecorations: Event<IResourceDecorationChangeEvent>;
47

J
Johannes Rieken 已提交
48
	registerDecorationsProvider(provider: IDecorationsProvider): IDisposable;
49

J
Johannes Rieken 已提交
50
	getDecoration(uri: URI, includeChildren: boolean): IDecoration;
51
}