src/vs/workbench/common/editor.ts/pathsToEditors
export async function pathsToEditors(paths: IPathData[] | undefined, fileService: IFileService): Promise<(IResourceEditorInput | IUntitledTextResourceEditorInput)[]> {
	if (!paths || !paths.length) {
		return [];
	}

	const editors = await Promise.all(paths.map(async path => {
		const resource = URI.revive(path.fileUri);
		if (!resource) {
			return;
		}

		const canHandleResource = await fileService.canHandleResource(resource);
		if (!canHandleResource) {
			return;
		}

		let exists = path.exists;
		let type = path.type;
		if (typeof exists !== 'boolean' || typeof type !== 'number') {
			try {
				type = (await fileService.stat(resource)).isDirectory ? FileType.Directory : FileType.Unknown;
				exists = true;
			} catch {
				exists = false;
			}
		}

		if (!exists && path.openOnlyIfExists) {
			return;
		}

		if (type === FileType.Directory) {
			return;
		}

		const options: IEditorOptions = {
			...path.options,
			pinned: true
		};

		let input: IResourceEditorInput | IUntitledTextResourceEditorInput;
		if (!exists) {
			input = { resource, options, forceUntitled: true };
		} else {
			input = { resource, options };
		}

		return input;
	}));

	return coalesce(editors);
}