Skip to content

Commit

Permalink
feat: Support bitbucket permalinks
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasco-jofra committed Dec 4, 2024
1 parent a6a9189 commit a483ca8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/codeMarker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2507,8 +2507,16 @@ export class CodeMarker implements vscode.TreeDataProvider<TreeEntry> {
return;
}

const issueLocation = `#L${location.startLine + 1}-L${location.endLine + 1}`;
const permalink = gitRemote + "/blob/" + sha + "/" + location.path + issueLocation;
const remoteHost = URL.parse(gitRemote)?.hostname;
let permalink;
if (remoteHost === "bitbucket.org") {
const issueLocation = `#lines${location.startLine + 1}:${location.endLine + 1}`;
permalink = gitRemote + "/src/" + sha + "/" + location.path + issueLocation;
} else {
const issueLocation = `#L${location.startLine + 1}-L${location.endLine + 1}`;
permalink = gitRemote + "/blob/" + sha + "/" + location.path + issueLocation;
}

return { remote: gitRemote, permalink };
}

Expand Down

0 comments on commit a483ca8

Please sign in to comment.