src/vs/workbench/services/editor/browser/editorService.ts/EditorService/replaceEditors
class EditorService:	async replaceEditors(replacements: Array<IEditorReplacement | IUntypedEditorReplacement>, group: IEditorGroup | GroupIdentifier): Promise<void> {
		const targetGroup = typeof group === 'number' ? this.editorGroupService.getGroup(group) : group;

		// Convert all replacements to typed editors unless already
		// typed and handle overrides properly.
		const typedReplacements: IEditorReplacement[] = [];
		for (const replacement of replacements) {
			let typedReplacement: IEditorReplacement | undefined = undefined;

			// Figure out the override rule based on options
			let override: string | EditorOverride | undefined;
			if (isEditorReplacement(replacement)) {
				override = replacement.options?.override;
			} else {
				override = replacement.replacement.options?.override;
			}

			// Resolve the override if not disabled
			if (override !== EditorOverride.DISABLED) {
				const [overrideResult, , resolvedOptions] = await this.doResolveEditor(
					isEditorReplacement(replacement) ? { editor: replacement.replacement, options: replacement.options } : replacement.replacement,
					targetGroup
				);

				if (!isEditorReplacement(replacement)) {
					replacement.replacement.options = resolvedOptions;
				}

				if (overrideResult === OverrideStatus.ABORT) {
					continue; // skip editor if override is aborted
				}

				// We have an override to use!
				if (isEditorInputWithOptions(overrideResult)) {
					typedReplacement = {
						editor: replacement.editor,
						replacement: overrideResult.editor,
						options: overrideResult.options ?? isEditorReplacement(replacement) ? (replacement as IEditorReplacement).options : replacement.replacement.options,
						forceReplaceDirty: replacement.forceReplaceDirty
					};
				}
			}

			// Override is disabled or did not apply
			if (!typedReplacement) {
				typedReplacement = {
					editor: replacement.editor,
					replacement: isEditorReplacement(replacement) ? replacement.replacement : this.createEditorInput(replacement.replacement),
					options: isEditorReplacement(replacement) ? replacement.options : replacement.replacement.options,
					forceReplaceDirty: replacement.forceReplaceDirty
				};
			}

			typedReplacements.push(typedReplacement);
		}

		if (targetGroup) {
			return targetGroup.replaceEditors(typedReplacements);
		}
	}