@@ -17,6 +17,9 @@ export type InitializeServiceConfig = {
1717 enableDialogService ?: boolean ;
1818 enableNotificationService ?: boolean ;
1919 enableModelService ?: boolean ;
20+ /**
21+ * editor service is the default. If you want to use the views service, set enableViewsService to true.
22+ */
2023 configureEditorOrViewsServiceConfig ?: {
2124 enableViewsService ?: boolean ;
2225 openEditorFunc ?: OpenEditor
@@ -179,21 +182,25 @@ export const importAllServices = async (config?: InitializeServiceConfig) => {
179182 reportServiceLoading ( userServices , lc . debugLogging === true , 'user' ) ;
180183 }
181184
185+ const haveThemeService = serviceNames . includes ( 'theme' ) || Object . keys ( overrideServices ) . includes ( 'themeService' ) ;
186+ const haveTextmateService = serviceNames . includes ( 'textmate' ) || Object . keys ( overrideServices ) . includes ( 'textMateTokenizationFeature' ) ;
187+ const haveQuickaccessService = serviceNames . includes ( 'quickaccess' ) || Object . keys ( overrideServices ) . includes ( 'quickInputService' ) ;
188+ const haveKeybindingsService = serviceNames . includes ( 'keybindings' ) || Object . keys ( overrideServices ) . includes ( 'keybindingService' ) ;
189+ const haveMarkersService = serviceNames . includes ( 'markers' ) ;
190+ const haveViewsService = serviceNames . includes ( 'views' ) || Object . keys ( overrideServices ) . includes ( 'viewsService' ) ;
191+
182192 // theme requires textmate
183- if ( ( serviceNames . includes ( 'theme' ) || Object . keys ( overrideServices ) . includes ( 'themeService' ) ) &&
184- ! ( serviceNames . includes ( 'textmate' ) || Object . keys ( overrideServices ) . includes ( 'textMateTokenizationFeature' ) ) ) {
193+ if ( haveThemeService && ! haveTextmateService ) {
185194 throw new Error ( '"theme" requires "textmate" service. Please add it to the "initServices" config.' ) ;
186195 }
187196
188197 // quickaccess requires keybindings
189- if ( ( serviceNames . includes ( 'quickaccess' ) || Object . keys ( overrideServices ) . includes ( 'quickInputService' ) ) &&
190- ! ( serviceNames . includes ( 'keybindings' ) || Object . keys ( overrideServices ) . includes ( 'keybindingService' ) ) ) {
198+ if ( haveQuickaccessService && ! haveKeybindingsService ) {
191199 throw new Error ( '"quickaccess" requires "keybindings" service. Please add it to the "initServices" config.' ) ;
192200 }
193201
194202 // markers service requires views service
195- if ( serviceNames . includes ( 'markers' ) &&
196- ! ( serviceNames . includes ( 'views' ) || Object . keys ( overrideServices ) . includes ( 'viewsService' ) ) ) {
203+ if ( haveMarkersService && ! haveViewsService ) {
197204 throw new Error ( '"markers" requires "views" service. Please add it to the "initServices" config.' ) ;
198205 }
199206
0 commit comments