src/vs/editor/standalone/browser/standaloneLanguages.ts/registerTokensProviderFactory
export function registerTokensProviderFactory(languageId: string, factory: TokensProviderFactory): IDisposable {
	const adaptedFactory: languages.ITokenizationSupportFactory = {
		createTokenizationSupport: async (): Promise<languages.ITokenizationSupport | null> => {
			const result = await Promise.resolve(factory.create());
			if (!result) {
				return null;
			}
			if (isATokensProvider(result)) {
				return createTokenizationSupportAdapter(languageId, result);
			}
			return new MonarchTokenizer(StandaloneServices.get(ILanguageService), StandaloneServices.get(IStandaloneThemeService), languageId, compile(languageId, result), StandaloneServices.get(IConfigurationService));
		}
	};
	return languages.TokenizationRegistry.registerFactory(languageId, adaptedFactory);
}