src/vs/workbench/contrib/terminal/browser/terminalEditorService.ts/TerminalEditorService/resolveResource
class TerminalEditorService:	resolveResource(instanceOrUri: ITerminalInstance | URI, isFutureSplit: boolean = false): URI {
		const resource: URI = URI.isUri(instanceOrUri) ? instanceOrUri : instanceOrUri.resource;
		const inputKey = resource.path;
		const cachedEditor = this._editorInputs.get(inputKey);

		if (cachedEditor) {
			return cachedEditor.resource;
		}

		// Terminal from a different window
		if (URI.isUri(instanceOrUri)) {
			const terminalIdentifier = parseTerminalUri(instanceOrUri);
			if (terminalIdentifier.instanceId) {
				const primaryBackend = this._terminalInstanceService.getBackend(this._environmentService.remoteAuthority);
				primaryBackend?.requestDetachInstance(terminalIdentifier.workspaceId, terminalIdentifier.instanceId).then(attachPersistentProcess => {
					const instance = this._terminalInstanceService.createInstance({ attachPersistentProcess }, TerminalLocation.Editor, resource);
					input = this._instantiationService.createInstance(TerminalEditorInput, resource, instance);
					this._editorService.openEditor(input, {
						pinned: true,
						forceReload: true
					},
						input.group
					);
					this._registerInstance(inputKey, input, instance);
					return instanceOrUri;
				});
			}
		}

		let input: TerminalEditorInput;
		if ('instanceId' in instanceOrUri) {
			instanceOrUri.target = TerminalLocation.Editor;
			input = this._instantiationService.createInstance(TerminalEditorInput, resource, instanceOrUri);
			this._registerInstance(inputKey, input, instanceOrUri);
			return input.resource;
		} else {
			return instanceOrUri;
		}
	}