@@ -20,6 +20,8 @@ import {
2020import { injector } from "../common/yok" ;
2121import { IInjector } from "../common/definitions/yok" ;
2222import { CommandsDelimiters } from "../common/constants" ;
23+ import { inject } from "../common/di/inject" ;
24+ import { CommandRegistry } from "../common/contracts" ;
2325import { isCommandDefinition } from "../common/define-command" ;
2426import { createCommandFromDefinition } from "../common/services/command-definition-adapter" ;
2527
@@ -57,6 +59,8 @@ export class ExtensibilityService implements IExtensibilityService {
5759 /** Command name -> name of the extension whose manifest claimed it first. */
5860 private manifestCommandOwners : IStringDictionary = { } ;
5961
62+ private commandRegistry = inject ( CommandRegistry ) ;
63+
6064 private get pathToPackageJson ( ) : string {
6165 return path . join ( this . pathToExtensions , constants . PACKAGE_JSON_FILE_NAME ) ;
6266 }
@@ -364,12 +368,12 @@ export class ExtensibilityService implements IExtensibilityService {
364368 const parentName = commandName . split (
365369 CommandsDelimiters . HierarchicalCommand ,
366370 ) [ 0 ] ;
367- const container = this . $injector . di ;
368371 const parentWasAbsent =
369- parentName !== commandName && ! container . has ( `commands.${ parentName } ` ) ;
372+ parentName !== commandName &&
373+ ! this . $injector . has ( `commands.${ parentName } ` ) ;
370374
371375 try {
372- this . $injector . requireCommand ( commandName , absoluteModulePath ) ;
376+ this . commandRegistry . requireCommand ( commandName , absoluteModulePath ) ;
373377 } catch ( err ) {
374378 const owner = this . manifestCommandOwners [ commandName ] ;
375379 const ownerInfo = owner
@@ -391,17 +395,17 @@ export class ExtensibilityService implements IExtensibilityService {
391395 const exported = require ( absoluteModulePath ) ;
392396 const candidate = ( exported && exported . default ) ?? exported ;
393397 if ( isCommandDefinition ( candidate ) ) {
394- this . $injector . registerCommand ( commandName , ( ) =>
398+ this . commandRegistry . registerCommand ( commandName , ( ) =>
395399 createCommandFromDefinition ( < any > candidate ) ,
396400 ) ;
397401 }
398402 } ;
399- container . register ( {
403+ this . $injector . register ( {
400404 provide : `commands.${ commandName } ` ,
401405 useLazyRequire : loader ,
402406 } ) ;
403407 if ( parentWasAbsent ) {
404- container . register ( {
408+ this . $injector . register ( {
405409 provide : `commands.${ parentName } ` ,
406410 useLazyRequire : loader ,
407411 } ) ;
0 commit comments