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:
Alexandru Dima
2022-11-25 16:52:36 +01:00
committed by GitHub
parent c7bdf0a299
commit 8a894eb038
64 changed files with 391 additions and 228 deletions

View File

@@ -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 {