/
extension.ts
108 lines (104 loc) · 2.63 KB
/
extension.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import type { UniqueId } from 'mo/common/types';
import { IExtensionService } from 'mo/services';
import { IColorTheme } from './colorTheme';
import { IIconTheme } from './iconTheme';
import { ILocale } from 'mo/i18n';
/**
* Defines extension types
*/
export enum IExtensionType {
Theme = 'Themes',
Normal = 'normal',
Settings = 'settings',
Locals = 'locales',
Menus = 'menus',
Workbench = 'workbench',
}
export enum IContributeType {
Languages = 'languages',
Commands = 'commands',
Configuration = 'configuration',
Grammar = 'grammars',
Themes = 'themes',
IconTheme = 'iconThemes',
}
export interface IContribute {
[IContributeType.Languages]?: ILocale[];
[IContributeType.Commands]?: any;
[IContributeType.Configuration]?: any;
[IContributeType.Grammar]?: any;
[IContributeType.Themes]?: IColorTheme[];
[IContributeType.IconTheme]?: IIconTheme[];
}
/**
* The interface of extension,
* there need every extension to implement this interface
*/
export interface IExtension {
/**
* The ID of extension required
*/
id: UniqueId;
/**
* The name of extension
*/
name: string;
/**
* The display name of extension
*/
displayName?: string;
/**
* The version of extension
*/
version?: string;
/**
* The categories of extension
*/
categories?: IExtensionType[];
/**
* The kind of extension
*/
extensionKind?: IExtensionType[];
/**
* The main file path of extension
* Extension system will load the extension by this file
*/
contributes?: IContribute;
/**
* The entry of extension
*/
main?: string;
/**
* The Icon of extension
*/
icon?: string | JSX.Element;
/**
* The description of extension
*/
description?: string;
/**
* The publisher of extension
*/
publisher?: string;
/**
* The path of extension
*/
path?: string;
/**
* Whether disable current extension, the extension default status is enable
*/
disable?: boolean;
/**
* Do something you want when the Extension is activating.
* The ExtensionService will call the `activate` method after
* added the Extension instance.
* @param extensionCtx The Context of Extension instance
*/
activate(extensionCtx: IExtensionService): void;
/**
* Do something when the Extension disposing.
* For example, you can recover the UI state, or remove the Objects in memory.
* @param extensionCtx The Context of Extension instance
*/
dispose(extensionCtx: IExtensionService): void;
}