跳到主要内容
版本:Next

Class: ExtensionService

molecule.ExtensionService

Implements​

Constructors​

constructor​

• new ExtensionService()

Defined in​

services/extensionService.ts:126

Properties​

_inactive​

• Private _inactive: undefined | Function

Defined in​

services/extensionService.ts:118


_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​

services/extensionService.ts:124


colorThemeService​

• Private Readonly colorThemeService: IColorThemeService

Defined in​

services/extensionService.ts:116


extensions​

• Private extensions: IExtension[] = []

Defined in​

services/extensionService.ts:115


localeService​

• Private Readonly localeService: ILocaleService

Defined in​

services/extensionService.ts:119


monacoService​

• Private Readonly monacoService: IMonacoService

Defined in​

services/extensionService.ts:117

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​

services/extensionService.ts:211


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​

services/extensionService.ts:152


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​

services/extensionService.ts:229


disposeAll​

▸ disposeAll(): void

Dispose all extensions, and reset the ExtensionService

Returns​

void

Implementation of​

IExtensionService.disposeAll

Defined in​

services/extensionService.ts:239


executeCommand​

▸ executeCommand(id, ...args): void

Execute the registered command

Parameters​

NameType
idany
...argsany[]

Returns​

void

Implementation of​

IExtensionService.executeCommand

Defined in​

services/extensionService.ts:207


getAllExtensions​

▸ getAllExtensions(): IExtension[]

Get All loaded extensions

Returns​

IExtension[]

Extension Array

Implementation of​

IExtensionService.getAllExtensions

Defined in​

services/extensionService.ts:148


getExtension​

▸ getExtension(id): undefined | IExtension

Get an extension by the ID

Parameters​

NameType
idUniqueId

Returns​

undefined | IExtension

Implementation of​

IExtensionService.getExtension

Defined in​

services/extensionService.ts:140


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​

services/extensionService.ts:246


isInactive​

▸ Private isInactive(extension): boolean

Parameters​

NameType
extensionIExtension

Returns​

boolean

Defined in​

services/extensionService.ts:250


isLoaded​

▸ isLoaded(): boolean

whether the extensions are loaded

Returns​

boolean

Implementation of​

IExtensionService.isLoaded

Defined in​

services/extensionService.ts:136


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​

services/extensionService.ts:172


loadContributes​

▸ loadContributes(contributes): void

Parameters​

NameType
contributesIContribute

Returns​

void

Defined in​

services/extensionService.ts:185


registerAction​

▸ registerAction(ActionClass): IDisposable

Register a new action which is extends the Action2, and return a disposable instance.

Parameters​

NameType
ActionClass() => Action2

Returns​

IDisposable

IDisposable The Disposable instance

Implementation of​

IExtensionService.registerAction

Defined in​

services/extensionService.ts:203


reset​

▸ reset(): void

Reset the extensions to []

Returns​

void

Implementation of​

IExtensionService.reset

Defined in​

services/extensionService.ts:144


setLoaded​

▸ setLoaded(flag?): void

Set the extensions are loaded

Parameters​

NameType
flag?boolean

Returns​

void

Implementation of​

IExtensionService.setLoaded

Defined in​

services/extensionService.ts:132


splitLanguagesExts​

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

Distinguish the language extensions from extensions

Parameters​

NameType
extensionsIExtension[]

Returns​

[IExtension[], IExtension[]]

Implementation of​

IExtensionService.splitLanguagesExts

Defined in​

services/extensionService.ts:257