Skip to content

Commit 6d7f44e

Browse files
AmandaCameroneamodio
authored andcommitted
Fix GitLab integration's multi-line selection.
1 parent 3a1caa2 commit 6d7f44e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/git/remotes/gitlab.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
import { Range } from 'vscode';
23
import { GitHubService } from './github';
34

45
export class GitLabService extends GitHubService {
@@ -10,4 +11,20 @@ export class GitLabService extends GitHubService {
1011
get name() {
1112
return this.formatName('GitLab');
1213
}
14+
15+
protected getUrlForFile(fileName: string, branch?: string, sha?: string, range?: Range): string {
16+
let line = '';
17+
if (range) {
18+
if (range.start.line === range.end.line) {
19+
line = `#L${range.start.line}`;
20+
}
21+
else {
22+
line = `#L${range.start.line}-${range.end.line}`;
23+
}
24+
}
25+
26+
if (sha) return `${this.baseUrl}/blob/${sha}/${fileName}${line}`;
27+
if (branch) return `${this.baseUrl}/blob/${branch}/${fileName}${line}`;
28+
return `${this.baseUrl}?path=${fileName}${line}`;
29+
}
1330
}

0 commit comments

Comments
 (0)