src/vs/editor/contrib/format/browser/format.ts/getOnTypeFormattingEdits
export function getOnTypeFormattingEdits(
	workerService: IEditorWorkerService,
	languageFeaturesService: ILanguageFeaturesService,
	model: ITextModel,
	position: Position,
	ch: string,
	options: FormattingOptions,
	token: CancellationToken
): Promise<TextEdit[] | null | undefined> {

	const providers = languageFeaturesService.onTypeFormattingEditProvider.ordered(model);

	if (providers.length === 0) {
		return Promise.resolve(undefined);
	}

	if (providers[0].autoFormatTriggerCharacters.indexOf(ch) < 0) {
		return Promise.resolve(undefined);
	}

	return Promise.resolve(providers[0].provideOnTypeFormattingEdits(model, position, ch, options, token)).catch(onUnexpectedExternalError).then(edits => {
		return workerService.computeMoreMinimalEdits(model.uri, edits);
	});
}