Skip to content

Commit

Permalink
Fix GitLab integration's multi-line selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmandaCameron authored and eamodio committed Sep 17, 2017
1 parent 3a1caa2 commit 6d7f44e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/git/remotes/gitlab.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';
import { Range } from 'vscode';
import { GitHubService } from './github';

export class GitLabService extends GitHubService {
Expand All @@ -10,4 +11,20 @@ export class GitLabService extends GitHubService {
get name() {
return this.formatName('GitLab');
}

protected getUrlForFile(fileName: string, branch?: string, sha?: string, range?: Range): string {
let line = '';
if (range) {
if (range.start.line === range.end.line) {
line = `#L${range.start.line}`;
}
else {
line = `#L${range.start.line}-${range.end.line}`;
}
}

if (sha) return `${this.baseUrl}/blob/${sha}/${fileName}${line}`;
if (branch) return `${this.baseUrl}/blob/${branch}/${fileName}${line}`;
return `${this.baseUrl}?path=${fileName}${line}`;
}
}

0 comments on commit 6d7f44e

Please sign in to comment.