|
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 | 'use strict'; |
6 | 6 |
|
7 | | -import Severity from 'vs/base/common/severity'; |
8 | | -import { TPromise } from 'vs/base/common/winjs.base'; |
9 | | -import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; |
10 | | -import { IExtensionPoint } from 'vs/platform/extensions/common/extensionsRegistry'; |
11 | | -import Event from 'vs/base/common/event'; |
12 | | - |
13 | | -export interface IExtensionDescription { |
14 | | - readonly id: string; |
15 | | - readonly name: string; |
16 | | - readonly uuid?: string; |
17 | | - readonly displayName?: string; |
18 | | - readonly version: string; |
19 | | - readonly publisher: string; |
20 | | - readonly isBuiltin: boolean; |
21 | | - readonly extensionFolderPath: string; |
22 | | - readonly extensionDependencies?: string[]; |
23 | | - readonly activationEvents?: string[]; |
24 | | - readonly engines: { |
25 | | - vscode: string; |
26 | | - }; |
27 | | - readonly main?: string; |
28 | | - readonly contributes?: { [point: string]: any; }; |
29 | | - readonly keywords?: string[]; |
30 | | - readonly repository?: { |
31 | | - url: string; |
32 | | - }; |
33 | | - enableProposedApi?: boolean; |
34 | | -} |
35 | | - |
36 | 7 | export const MANIFEST_CACHE_FOLDER = 'CachedExtensions'; |
37 | 8 | export const USER_MANIFEST_CACHE_FILE = 'user'; |
38 | 9 | export const BUILTIN_MANIFEST_CACHE_FILE = 'builtin'; |
39 | | - |
40 | | -export const IExtensionService = createDecorator<IExtensionService>('extensionService'); |
41 | | - |
42 | | -export interface IMessage { |
43 | | - type: Severity; |
44 | | - message: string; |
45 | | - source: string; |
46 | | - extensionId: string; |
47 | | - extensionPointId: string; |
48 | | -} |
49 | | - |
50 | | -export interface IExtensionsStatus { |
51 | | - messages: IMessage[]; |
52 | | - activationTimes: ActivationTimes; |
53 | | - runtimeErrors: Error[]; |
54 | | -} |
55 | | - |
56 | | -/** |
57 | | - * e.g. |
58 | | - * ``` |
59 | | - * { |
60 | | - * startTime: 1511954813493000, |
61 | | - * endTime: 1511954835590000, |
62 | | - * deltas: [ 100, 1500, 123456, 1500, 100000 ], |
63 | | - * ids: [ 'idle', 'self', 'extension1', 'self', 'idle' ] |
64 | | - * } |
65 | | - * ``` |
66 | | - */ |
67 | | -export interface IExtensionHostProfile { |
68 | | - /** |
69 | | - * Profiling start timestamp in microseconds. |
70 | | - */ |
71 | | - startTime: number; |
72 | | - /** |
73 | | - * Profiling end timestamp in microseconds. |
74 | | - */ |
75 | | - endTime: number; |
76 | | - /** |
77 | | - * Duration of segment in microseconds. |
78 | | - */ |
79 | | - deltas: number[]; |
80 | | - /** |
81 | | - * Segment identifier: extension id or one of the four known strings. |
82 | | - */ |
83 | | - ids: ProfileSegmentId[]; |
84 | | - |
85 | | - /** |
86 | | - * Get the information as a .cpuprofile. |
87 | | - */ |
88 | | - data: object; |
89 | | - |
90 | | - /** |
91 | | - * Get the aggregated time per segmentId |
92 | | - */ |
93 | | - getAggregatedTimes(): Map<ProfileSegmentId, number>; |
94 | | -} |
95 | | - |
96 | | -/** |
97 | | - * Extension id or one of the four known program states. |
98 | | - */ |
99 | | -export type ProfileSegmentId = string | 'idle' | 'program' | 'gc' | 'self'; |
100 | | - |
101 | | -export class ActivationTimes { |
102 | | - constructor( |
103 | | - public readonly startup: boolean, |
104 | | - public readonly codeLoadingTime: number, |
105 | | - public readonly activateCallTime: number, |
106 | | - public readonly activateResolvedTime: number, |
107 | | - public readonly activationEvent: string |
108 | | - ) { |
109 | | - } |
110 | | -} |
111 | | - |
112 | | -export class ExtensionPointContribution<T> { |
113 | | - readonly description: IExtensionDescription; |
114 | | - readonly value: T; |
115 | | - |
116 | | - constructor(description: IExtensionDescription, value: T) { |
117 | | - this.description = description; |
118 | | - this.value = value; |
119 | | - } |
120 | | -} |
121 | | - |
122 | | -export interface IExtensionService { |
123 | | - _serviceBrand: any; |
124 | | - |
125 | | - /** |
126 | | - * An event emitted when extensions are registered after their extension points got handled. |
127 | | - * |
128 | | - * This event will also fire on startup to signal the installed extensions. |
129 | | - * |
130 | | - * @returns the extensions that got registered |
131 | | - */ |
132 | | - onDidRegisterExtensions: Event<void>; |
133 | | - |
134 | | - /** |
135 | | - * @event |
136 | | - * Fired when extensions status changes. |
137 | | - * The event contains the ids of the extensions that have changed. |
138 | | - */ |
139 | | - onDidChangeExtensionsStatus: Event<string[]>; |
140 | | - |
141 | | - /** |
142 | | - * Send an activation event and activate interested extensions. |
143 | | - */ |
144 | | - activateByEvent(activationEvent: string): TPromise<void>; |
145 | | - |
146 | | - /** |
147 | | - * An promise that resolves when the installed extensions are registered after |
148 | | - * their extension points got handled. |
149 | | - */ |
150 | | - whenInstalledExtensionsRegistered(): TPromise<boolean>; |
151 | | - |
152 | | - /** |
153 | | - * Return all registered extensions |
154 | | - */ |
155 | | - getExtensions(): TPromise<IExtensionDescription[]>; |
156 | | - |
157 | | - /** |
158 | | - * Read all contributions to an extension point. |
159 | | - */ |
160 | | - readExtensionPointContributions<T>(extPoint: IExtensionPoint<T>): TPromise<ExtensionPointContribution<T>[]>; |
161 | | - |
162 | | - /** |
163 | | - * Get information about extensions status. |
164 | | - */ |
165 | | - getExtensionsStatus(): { [id: string]: IExtensionsStatus }; |
166 | | - |
167 | | - /** |
168 | | - * Check if the extension host can be profiled. |
169 | | - */ |
170 | | - canProfileExtensionHost(): boolean; |
171 | | - |
172 | | - /** |
173 | | - * Begin an extension host process profile session. |
174 | | - */ |
175 | | - startExtensionHostProfile(): TPromise<ProfileSession>; |
176 | | - |
177 | | - /** |
178 | | - * Restarts the extension host. |
179 | | - */ |
180 | | - restartExtensionHost(): void; |
181 | | - |
182 | | - /** |
183 | | - * Starts the extension host. |
184 | | - */ |
185 | | - startExtensionHost(): void; |
186 | | - |
187 | | - /** |
188 | | - * Stops the extension host. |
189 | | - */ |
190 | | - stopExtensionHost(): void; |
191 | | -} |
192 | | - |
193 | | -export interface ProfileSession { |
194 | | - stop(): TPromise<IExtensionHostProfile>; |
195 | | -} |
0 commit comments