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;
J
Johannes Rieken 已提交
18
	readonly opacity?: number;
19 20
	readonly letter?: string;
	readonly tooltip?: string;
21
}
22

J
Johannes Rieken 已提交
23
export interface IDecoration {
24
	readonly _decoBrand: undefined;
25
	readonly weight?: number;
26 27 28
	readonly tooltip?: string;
	readonly labelClassName?: string;
	readonly badgeClassName?: string;
29 30
}

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

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

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

	readonly _serviceBrand: any;

45
	readonly onDidChangeDecorations: Event<IResourceDecorationChangeEvent>;
46

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

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