11import '../polyfill'
22import '../vscode-services/missing-services'
3- import { StandaloneServices , IEditorOverrideServices } from 'vs/editor/standalone/browser/standaloneServices'
3+ import { IEditorOverrideServices } from 'vs/editor/standalone/browser/standaloneServices'
44import { ITextMateService } from 'vs/workbench/services/textMate/browser/textMate'
55import { ExtensionMessageCollector } from 'vs/workbench/services/extensions/common/extensionsRegistry'
66import { ITMSyntaxExtensionPoint } from 'vs/workbench/services/textMate/common/TMGrammars'
@@ -10,7 +10,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
1010import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'
1111import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'
1212import getFileServiceOverride , { registerExtensionFile } from './files'
13- import { consoleExtensionMessageHandler , getExtensionPoint } from './tools'
13+ import { consoleExtensionMessageHandler , getExtensionPoint , onServicesInitialized } from './tools'
1414import { Services } from '../services'
1515import { DEFAULT_EXTENSION } from '../vscode-services/extHost'
1616import { createInjectedClass } from '../tools/injection'
@@ -28,9 +28,10 @@ class TextMateService extends createInjectedClass(AbstractTextMateService) {
2828 }
2929}
3030
31- const extensionPoint = getExtensionPoint < ITMSyntaxExtensionPoint [ ] > ( 'grammars' )
31+ type PartialITMSyntaxExtensionPoint = Partial < ITMSyntaxExtensionPoint > & Pick < ITMSyntaxExtensionPoint , 'path' | 'scopeName' >
32+ const extensionPoint = getExtensionPoint < PartialITMSyntaxExtensionPoint [ ] > ( 'grammars' )
3233
33- export function setGrammars < T extends ITMSyntaxExtensionPoint > ( grammars : T [ ] , getContent : ( grammar : T ) => Promise < string > , extension : IExtensionDescription = Services . get ( ) . extension ?? DEFAULT_EXTENSION ) : void {
34+ export function setGrammars < T extends PartialITMSyntaxExtensionPoint > ( grammars : T [ ] , getContent : ( grammar : T ) => Promise < string > , extension : IExtensionDescription = Services . get ( ) . extension ?? DEFAULT_EXTENSION ) : void {
3435 extensionPoint . acceptUsers ( [ {
3536 description : extension ,
3637 value : grammars ,
@@ -42,14 +43,13 @@ export function setGrammars<T extends ITMSyntaxExtensionPoint> (grammars: T[], g
4243 }
4344}
4445
45- function initialize ( ) {
46- // LanguageConfigurationFileHandler
46+ function initialize ( instantiationService : IInstantiationService ) {
4747 // Force load the service
48- StandaloneServices . get ( ITextMateService )
48+ instantiationService . invokeFunction ( ( accessor ) => accessor . get ( ITextMateService ) )
4949}
5050
5151export default function getServiceOverride ( getOnigLib : ( ) => Promise < Response | ArrayBuffer > ) : IEditorOverrideServices {
52- setTimeout ( initialize )
52+ onServicesInitialized ( initialize )
5353 return {
5454 ...getFileServiceOverride ( ) ,
5555 [ ITextMateService . toString ( ) ] : new SyncDescriptor ( TextMateService , [ getOnigLib ] )
@@ -58,5 +58,5 @@ export default function getServiceOverride (getOnigLib: () => Promise<Response |
5858
5959export {
6060 ITextMateService ,
61- ITMSyntaxExtensionPoint
61+ PartialITMSyntaxExtensionPoint as ITMSyntaxExtensionPoint
6262}
0 commit comments