src/vs/workbench/contrib/terminal/browser/terminalEditorService.ts/TerminalEditorService/detachActiveEditorInstance
class TerminalEditorService:	detachActiveEditorInstance(): ITerminalInstance {
		const activeEditor = this._editorService.activeEditor;
		if (!(activeEditor instanceof TerminalEditorInput)) {
			// should never happen now with the terminalEditorActive context key
			throw new Error('Active editor is not a terminal');
		}
		const instance = activeEditor.terminalInstance;
		if (!instance) {
			throw new Error('Terminal is already detached');
		}
		this.detachInstance(instance);
		return instance;
	}