extensions/markdown-language-features/src/util/openDocumentLink.ts/openDocumentLink
export async function openDocumentLink(tocProvider: MdTableOfContentsProvider, targetResource: vscode.Uri, fromResource: vscode.Uri): Promise<void> {
	const column = getViewColumn(fromResource);

	if (await tryNavigateToFragmentInActiveEditor(tocProvider, targetResource)) {
		return;
	}

	let targetResourceStat: vscode.FileStat | undefined;
	try {
		targetResourceStat = await vscode.workspace.fs.stat(targetResource);
	} catch {
		// noop
	}

	if (typeof targetResourceStat === 'undefined') {
		// We don't think the file exists. If it doesn't already have an extension, try tacking on a `.md` and using that instead
		if (uri.Utils.extname(targetResource) === '') {
			const dotMdResource = targetResource.with({ path: targetResource.path + '.md' });
			try {
				const stat = await vscode.workspace.fs.stat(dotMdResource);
				if (stat.type === vscode.FileType.File) {
					await tryOpenMdFile(tocProvider, dotMdResource, column);
					return;
				}
			} catch {
				// noop
			}
		}
	} else if (targetResourceStat.type === vscode.FileType.Directory) {
		return vscode.commands.executeCommand('revealInExplorer', targetResource);
	}

	await tryOpenMdFile(tocProvider, targetResource, column);
}