@@ -100,7 +100,9 @@ export class NotebookProviderInfoStore extends Disposable {
100
100
builtinProvidersFromCache . set ( builtin . id , this . add ( builtin ) ) ;
101
101
} ) ;
102
102
103
+
103
104
for ( const extension of extensions ) {
105
+ const implicitActivationEvents : string [ ] = [ ] ;
104
106
for ( const notebookContribution of extension . value ) {
105
107
106
108
if ( ! notebookContribution . type ) {
@@ -114,6 +116,7 @@ export class NotebookProviderInfoStore extends Disposable {
114
116
if ( ! existing . extension && extension . description . isBuiltin && builtins . find ( builtin => builtin . id === notebookContribution . type ) ) {
115
117
// we are registering an extension which is using the same view type which is already cached
116
118
builtinProvidersFromCache . get ( notebookContribution . type ) ?. dispose ( ) ;
119
+ implicitActivationEvents . push ( `onNotebookSerializer:${ notebookContribution . type } ` ) ;
117
120
} else {
118
121
extension . collector . error ( `Notebook type '${ notebookContribution . type } ' already used` ) ;
119
122
continue ;
@@ -129,7 +132,9 @@ export class NotebookProviderInfoStore extends Disposable {
129
132
providerDisplayName : extension . description . displayName ?? extension . description . identifier . value ,
130
133
exclusive : false
131
134
} ) ) ;
135
+
132
136
}
137
+ extension . implicitActivationEventsCollector . addImplicitActivationEvents ( implicitActivationEvents ) ;
133
138
}
134
139
135
140
const mementoObject = this . _memento . getMemento ( StorageScope . PROFILE , StorageTarget . MACHINE ) ;
@@ -606,20 +611,7 @@ export class NotebookService extends Disposable implements INotebookService {
606
611
}
607
612
608
613
await this . _extensionService . whenInstalledExtensionsRegistered ( ) ;
609
-
610
- const info = this . _notebookProviderInfoStore ?. get ( viewType ) ;
611
- const waitFor : Promise < any > [ ] = [ Event . toPromise ( Event . filter ( this . onAddViewType , ( ) => {
612
- return this . _notebookProviders . has ( viewType ) ;
613
- } ) ) ] ;
614
-
615
- if ( info && info . extension ) {
616
- const extensionManifest = await this . _extensionService . getExtension ( info . extension . value ) ;
617
- if ( extensionManifest ?. activationEvents && extensionManifest . activationEvents . indexOf ( `onNotebook:${ viewType } ` ) >= 0 ) {
618
- waitFor . push ( this . _extensionService . _activateById ( info . extension , { startup : false , activationEvent : `onNotebook:${ viewType } }` , extensionId : info . extension } ) ) ;
619
- }
620
- }
621
-
622
- await Promise . race ( waitFor ) ;
614
+ await this . _extensionService . activateByEvent ( `onNotebookSerializer:${ viewType } ` ) ;
623
615
624
616
return this . _notebookProviders . has ( viewType ) ;
625
617
}
0 commit comments