GitHub - add "Open on GitHub" to blame hover (#237514)

* WIP - saving my work

* Refactor hover rendering code
This commit is contained in:
Ladislau Szomoru
2025-01-08 20:34:54 +01:00
committed by GitHub
parent 1329d03879
commit dca80ea667
11 changed files with 147 additions and 57 deletions

View File

@@ -186,6 +186,15 @@ export function getBranchLink(url: string, branch: string, hostPrefix: string =
return `${hostPrefix}/${repo.owner}/${repo.repo}/tree/${branch}`;
}
export function getCommitLink(url: string, hash: string, hostPrefix: string = 'https://github.com') {
const repo = getRepositoryFromUrl(url);
if (!repo) {
throw new Error('Invalid repository URL provided');
}
return `${hostPrefix}/${repo.owner}/${repo.repo}/commit/${hash}`;
}
export function getVscodeDevHost(): string {
return `https://${vscode.env.appName.toLowerCase().includes('insiders') ? 'insiders.' : ''}vscode.dev/github`;
}