@@ -52,6 +52,19 @@ class Bitbucket extends BaseProvider {
5252}
5353
5454class GitLab extends GitHub {
55+ webUrl ( branch , filePath , line , endLine ) {
56+ if ( filePath ) {
57+ return `${ this . baseUrl } /blob/${ branch } ` + ( filePath ? `${ filePath } ` : '' ) + ( line ? `#L-${ line } ` : '' ) ;
58+ }
59+ return `${ this . baseUrl } /tree/${ branch } ` ;
60+ }
61+ prUrl ( branch ) {
62+ //https://docs.gitlab.com/ee/api/merge_requests.html#create-mr
63+ // doesn't support yet, require target_branch, title to supply further
64+ throw new Error ( `doesn't support Merge Request from URL in gitlab provider yet` ) ;
65+ //TODO
66+ //return `${this.baseUrl}/merge-requests/new?source_branch=${branch}&target_branch=${????}&title=${????}`;
67+ }
5568}
5669
5770class VisualStudio extends BaseProvider {
@@ -74,6 +87,7 @@ class VisualStudio extends BaseProvider {
7487}
7588
7689const gitHubDomain = workspace . getConfiguration ( 'openInGitHub' ) . get ( 'gitHubDomain' , 'github.com' ) ;
90+ const providerType = workspace . getConfiguration ( 'openInGitHub' ) . get ( 'providerType' , 'unknown' ) ;
7791
7892const providers = {
7993 [ gitHubDomain ] : GitHub ,
@@ -89,13 +103,16 @@ const providers = {
89103 * @return {BaseProvider|null }
90104 */
91105function gitProvider ( remoteUrl ) {
106+ console . log ( providerType ) ;
92107 const gitUrl = gitUrlParse ( remoteUrl ) ;
93108 for ( const domain of Object . keys ( providers ) ) {
94109 if ( domain === gitUrl . resource || domain === gitUrl . source ) {
95110 return new providers [ domain ] ( gitUrl ) ;
111+ } else if ( domain . indexOf ( providerType ) > - 1 ) {
112+ return new providers [ domain ] ( gitUrl ) ;
96113 }
97114 }
98- return null ;
115+ throw new Error ( 'unknown Provider' ) ;
99116}
100117
101118module . exports = gitProvider ;
0 commit comments