Skip to content

Commit 18ae9e6

Browse files
committed
github link to typedef points to comment lines
1 parent 487336f commit 18ae9e6

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/github.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,20 @@ module.exports = function(comment: Comment) {
2121
.join('/');
2222

2323
if (urlPrefix) {
24+
let startLine;
25+
let endLine;
26+
27+
if (comment.kind == 'typedef') {
28+
startLine = comment.loc.start.line;
29+
endLine = comment.loc.end.line;
30+
} else {
31+
startLine = comment.context.loc.start.line;
32+
endLine = comment.context.loc.end.line;
33+
}
34+
2435
comment.context.github = {
2536
url:
26-
urlPrefix +
27-
fileRelativePath +
28-
'#L' +
29-
comment.context.loc.start.line +
30-
'-' +
31-
'L' +
32-
comment.context.loc.end.line,
37+
urlPrefix + fileRelativePath + '#L' + startLine + '-' + 'L' + endLine,
3338
path: fileRelativePath
3439
};
3540
}

0 commit comments

Comments
 (0)