extensions/markdown-language-features/src/languageFeatures/dropIntoEditor.ts/tryGetUriListSnippet
export async function tryGetUriListSnippet(document: vscode.TextDocument, dataTransfer: vscode.DataTransfer, token: vscode.CancellationToken): Promise<vscode.SnippetString | undefined> {
	const urlList = await dataTransfer.get('text/uri-list')?.asString();
	if (!urlList || token.isCancellationRequested) {
		return undefined;
	}

	const uris: vscode.Uri[] = [];
	for (const resource of urlList.split('\n')) {
		try {
			uris.push(vscode.Uri.parse(resource));
		} catch {
			// noop
		}
	}

	if (!uris.length) {
		return;
	}

	const snippet = new vscode.SnippetString();
	uris.forEach((uri, i) => {
		const mdPath = document.uri.scheme === uri.scheme
			? encodeURI(path.relative(URI.Utils.dirname(document.uri).fsPath, uri.fsPath).replace(/\\/g, '/'))
			: uri.toString(false);

		const ext = URI.Utils.extname(uri).toLowerCase();
		snippet.appendText(imageFileExtensions.has(ext) ? '![' : '[');
		snippet.appendTabstop();
		snippet.appendText(`](${mdPath})`);

		if (i <= uris.length - 1 && uris.length > 1) {
			snippet.appendText(' ');
		}
	});

	return snippet;
}