mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
Adopt idle instantiation in editor contributions and use explicit syntax in the ones which need to be eager (#166966)
* Adopt idle instantiation in editor contributions and use explicit syntax in the ones which need to be eager * Make sure all editor contributions are eventually instantiated * Introduce multiple values for `EditorContributionInstantiation` and adopt them
This commit is contained in:
@@ -30,18 +30,37 @@ export type ServicesAccessor = InstantiationServicesAccessor;
|
||||
export type IEditorContributionCtor = IConstructorSignature<IEditorContribution, [ICodeEditor]>;
|
||||
export type IDiffEditorContributionCtor = IConstructorSignature<IDiffEditorContribution, [IDiffEditor]>;
|
||||
|
||||
export enum EditorContributionInstantiation {
|
||||
export const enum EditorContributionInstantiation {
|
||||
/**
|
||||
* The contribution is created eagerly when the {@linkcode ICodeEditor} is instantiated.
|
||||
* Only Eager contributions can participate in saving or restoring of view state.
|
||||
*/
|
||||
Eager,
|
||||
|
||||
/**
|
||||
* The contribution is created on idle (or when explicitly requested).
|
||||
*
|
||||
* Idle contributions cannot participate in saving or restoring of view states.
|
||||
* The contribution is created at the latest 50ms after the first render after attaching a text model.
|
||||
* If the contribution is explicitly requested via `getContribution`, it will be instantiated sooner.
|
||||
* If there is idle time available, it will be instantiated sooner.
|
||||
*/
|
||||
Idle,
|
||||
AfterFirstRender,
|
||||
|
||||
/**
|
||||
* The contribution is created before the editor emits events produced by user interaction (mouse events, keyboard events).
|
||||
* If the contribution is explicitly requested via `getContribution`, it will be instantiated sooner.
|
||||
* If there is idle time available, it will be instantiated sooner.
|
||||
*/
|
||||
BeforeFirstInteraction,
|
||||
|
||||
/**
|
||||
* The contribution is created when there is idle time available, at the latest 5000ms after the editor creation.
|
||||
* If the contribution is explicitly requested via `getContribution`, it will be instantiated sooner.
|
||||
*/
|
||||
Eventually,
|
||||
|
||||
/**
|
||||
* The contribution is created only when explicitly requested via `getContribution`.
|
||||
*/
|
||||
Lazy,
|
||||
}
|
||||
|
||||
export interface IEditorContributionDescription {
|
||||
|
||||
Reference in New Issue
Block a user