extensions.ts 2.6 KB
Newer Older
J
Joao Moreno 已提交
1 2 3 4 5
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

J
Johannes Rieken 已提交
6
import { IViewlet } from 'vs/workbench/common/viewlet';
7
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
8 9 10
import Event from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import { IPager } from 'vs/base/common/paging';
J
Joao Moreno 已提交
11
import { IQueryOptions, IExtensionManifest, LocalExtensionType } from 'vs/platform/extensionManagement/common/extensionManagement';
J
Joao Moreno 已提交
12

J
Joao Moreno 已提交
13
export const VIEWLET_ID = 'workbench.view.extensions';
14

J
Joao Moreno 已提交
15
export interface IExtensionsViewlet extends IViewlet {
16
	search(text: string): void;
17
}
18 19 20 21

export enum ExtensionState {
	Installing,
	Installed,
J
Joao Moreno 已提交
22
	NeedsRestart,
23 24 25 26
	Uninstalled
}

export interface IExtension {
J
Joao Moreno 已提交
27
	type: LocalExtensionType;
28 29 30 31 32 33 34 35 36
	state: ExtensionState;
	name: string;
	displayName: string;
	publisher: string;
	publisherDisplayName: string;
	version: string;
	latestVersion: string;
	description: string;
	iconUrl: string;
37
	iconUrlFallback: string;
38
	licenseUrl: string;
39 40 41
	installCount: number;
	rating: number;
	ratingCount: number;
42
	outdated: boolean;
43
	disabled: boolean;
S
Sandeep Somavarapu 已提交
44
	hasDependencies: boolean;
45
	telemetryData: any;
J
Joao Moreno 已提交
46 47
	getManifest(): TPromise<IExtensionManifest>;
	getReadme(): TPromise<string>;
J
Johannes Rieken 已提交
48 49
	hasChangelog: boolean;
	getChangelog(): TPromise<string>;
50 51
}

S
Sandeep Somavarapu 已提交
52 53 54 55 56 57 58
export interface IExtensionDependencies {
	dependencies: IExtensionDependencies[];
	hasDependencies: boolean;
	extension: IExtension;
	dependent: IExtensionDependencies;
}

B
Benjamin Pasero 已提交
59
export const SERVICE_ID = 'extensionsWorkbenchService';
60

B
Benjamin Pasero 已提交
61
export const IExtensionsWorkbenchService = createDecorator<IExtensionsWorkbenchService>(SERVICE_ID);
62 63

export interface IExtensionsWorkbenchService {
64
	_serviceBrand: any;
65 66 67 68 69
	onChange: Event<void>;
	local: IExtension[];
	queryLocal(): TPromise<IExtension[]>;
	queryGallery(options?: IQueryOptions): TPromise<IPager<IExtension>>;
	canInstall(extension: IExtension): boolean;
J
Joao Moreno 已提交
70
	install(vsix: string): TPromise<void>;
S
Sandeep Somavarapu 已提交
71
	install(extension: IExtension, promptToInstallDependencies?: boolean): TPromise<void>;
72
	uninstall(extension: IExtension): TPromise<void>;
S
Sandeep Somavarapu 已提交
73
	loadDependencies(extension: IExtension): TPromise<IExtensionDependencies>;
74
	open(extension: IExtension, sideByside?: boolean): TPromise<any>;
J
Joao Moreno 已提交
75 76
}

J
Joao Moreno 已提交
77
export const ConfigurationKey = 'extensions';
S
Sandeep Somavarapu 已提交
78

J
Joao Moreno 已提交
79 80
export interface IExtensionsConfiguration {
	autoUpdate: boolean;
S
Sandeep Somavarapu 已提交
81
	recommendations: string[];
82
}