跳到主要内容
版本:0.9.0-beta.2

Class: ExtensionService

molecule.ExtensionService

Implements

Constructors

constructor

new ExtensionService()

Defined in

src/services/extensionService.ts:122

Properties

_inactive

Private _inactive: undefined | Function

Defined in

src/services/extensionService.ts:114


_isLoaded

Private _isLoaded: boolean = false

TODO: This property is used for marking the extensions were loaded we are going to refactor this logic after redesign the Molecule lifecycle.

Defined in

src/services/extensionService.ts:120


colorThemeService

Private Readonly colorThemeService: IColorThemeService

Defined in

src/services/extensionService.ts:112


extensions

Private extensions: IExtension[] = []

Defined in

src/services/extensionService.ts:111


localeService

Private Readonly localeService: ILocaleService

Defined in

src/services/extensionService.ts:115


monacoService

Private Readonly monacoService: IMonacoService

Defined in

src/services/extensionService.ts:113

Methods

activate

activate(extensions): void

Activate the extensions (includes contributes type). Notice: this method only do the activate work, not store the data into ExtensionService, which means you can't get the Extension by the ExtensionService. getExtension method.

Parameters

NameType
extensionsIExtension[]

Returns

void

Implementation of

IExtensionService.activate

Defined in

src/services/extensionService.ts:207


add

add(extensions): null | IExtension[]

Add the extensions to ExtensionService, but no activated.

Parameters

NameType
extensionsIExtension[]

Returns

null | IExtension[]

Unload Extensions

Implementation of

IExtensionService.add

Defined in

src/services/extensionService.ts:148


dispose

dispose(extensionId): void

Dispose the specific extension, and remove it from the ExtensionService

Parameters

NameType
extensionIdUniqueId

Returns

void

Implementation of

IExtensionService.dispose

Defined in

src/services/extensionService.ts:225


disposeAll

disposeAll(): void

Dispose all extensions, and reset the ExtensionService

Returns

void

Implementation of

IExtensionService.disposeAll

Defined in

src/services/extensionService.ts:235


executeCommand

executeCommand(id, ...args): void

Execute the registered command

Parameters

NameType
idany
...argsany[]

Returns

void

Implementation of

IExtensionService.executeCommand

Defined in

src/services/extensionService.ts:203


getAllExtensions

getAllExtensions(): IExtension[]

Get All loaded extensions

Returns

IExtension[]

Extension Array

Implementation of

IExtensionService.getAllExtensions

Defined in

src/services/extensionService.ts:144


getExtension

getExtension(id): undefined | IExtension

Get an extension by the ID

Parameters

NameType
idUniqueId

Returns

undefined | IExtension

Implementation of

IExtensionService.getExtension

Defined in

src/services/extensionService.ts:136


inactive

inactive(predicate): void

Disable to activate some extensions, make use of it to filter some extensions no need to activate. You need register the inactive event before the MoleculeProvider declaration.

Parameters

NameType
predicate(extension: IExtension) => boolean

Returns

void

Implementation of

IExtensionService.inactive

Defined in

src/services/extensionService.ts:242


isInactive

Private isInactive(extension): boolean

Parameters

NameType
extensionIExtension

Returns

boolean

Defined in

src/services/extensionService.ts:246


isLoaded

isLoaded(): boolean

whether the extensions are loaded

Returns

boolean

Implementation of

IExtensionService.isLoaded

Defined in

src/services/extensionService.ts:132


load

load(extensions): void

Load the extension instances and then activate them. Notice: The ExtensionService doesn't load an existed Extension, if you want inactivate someone extension, there can use the ExtensionService.inactive method, also if you want remove a extension, you can use the ExtensionService.dispose method.

Parameters

NameType
extensionsIExtension[]

Returns

void

Implementation of

IExtensionService.load

Defined in

src/services/extensionService.ts:168


loadContributes

loadContributes(contributes): void

Parameters

NameType
contributesIContribute

Returns

void

Defined in

src/services/extensionService.ts:181


registerAction

registerAction(actionClass): void

Register a new action which is extends the Action2,

Parameters

NameType
actionClass() => Action2

Returns

void

Implementation of

IExtensionService.registerAction

Defined in

src/services/extensionService.ts:199


reset

reset(): void

Reset the extensions to []

Returns

void

Implementation of

IExtensionService.reset

Defined in

src/services/extensionService.ts:140


setLoaded

setLoaded(flag?): void

Set the extensions are loaded

Parameters

NameType
flag?boolean

Returns

void

Implementation of

IExtensionService.setLoaded

Defined in

src/services/extensionService.ts:128


splitLanguagesExts

splitLanguagesExts(extensions): [IExtension[], IExtension[]]

Distinguish the language extensions from extensions

Parameters

NameType
extensionsIExtension[]

Returns

[IExtension[], IExtension[]]

Implementation of

IExtensionService.splitLanguagesExts

Defined in

src/services/extensionService.ts:253