extensions/markdown-language-features/src/preview/scrolling.ts/toRevealRange
function toRevealRange(line: number, editor: vscode.TextEditor): vscode.Range {
	const sourceLine = Math.floor(line);
	if (sourceLine >= editor.document.lineCount) {
		return new vscode.Range(editor.document.lineCount - 1, 0, editor.document.lineCount - 1, 0);
	}

	const fraction = line - sourceLine;
	const text = editor.document.lineAt(sourceLine).text;
	const start = Math.floor(fraction * text.length);
	return new vscode.Range(sourceLine, start, sourceLine + 1, 0);
}