src/vs/workbench/browser/parts/editor/editor.ts/getActiveTextEditorOptions
export function getActiveTextEditorOptions(group: IEditorGroup, expectedActiveEditor?: IEditorInput, presetOptions?: IEditorOptions): ITextEditorOptions {
	const activeGroupCodeEditor = group.activeEditorPane ? getIEditor(group.activeEditorPane.getControl()) : undefined;
	if (activeGroupCodeEditor) {
		if (!expectedActiveEditor || !group.activeEditor || expectedActiveEditor.matches(group.activeEditor)) {
			const textOptions: ITextEditorOptions = {
				...presetOptions,
				viewState: withNullAsUndefined(activeGroupCodeEditor.saveViewState())
			};

			return textOptions;
		}
	}

	return presetOptions || Object.create(null);
}