diff --git a/CHANGELOG.md b/CHANGELOG.md index 605d88a452254..ba1d0c6b72ae8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Fixed + +- Fixes [#1449](https://github.com/eamodio/vscode-gitlens/issues/1449) - Configured remotes not showing up in quickpick menu when opening commit on remote + ## [11.5.1] - 2021-06-14 ### Fixed diff --git a/README.md b/README.md index c92059b7f9541..a067affdd4c25 100644 --- a/README.md +++ b/README.md @@ -954,10 +954,10 @@ See also [View Settings](#view-settings- 'Jump to the View settings') ## Remote Provider Integration Settings [#](#remote-provider-integration-settings- 'Remote Provider Integration Settings') -| Name | Description | -| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `gitlens.integrations.enabled` | Specifies whether to enable rich integrations with any supported remote services | -| `gitlens.remotes` | Specifies user-defined remote (code-hosting) services or custom domains for built-in remote services

Supported Types (e.g. `"type": "GitHub"`):Example:
`"gitlens.remotes": [{ "domain": "git.corporate-url.com", "type": "GitHub" }]`

Example:
`"gitlens.remotes": [{`
    `"domain": "git.corporate-url.com",`
    `"type": "Custom",`
    `"name": "My Company",`
    `"protocol": "https",`
    `"urls": {`
        `"repository": "https://git.corporate-url.com/${repo}",`
        `"branches": "https://git.corporate-url.com/${repo}/branches",`
        `"branch": "https://git.corporate-url.com/${repo}/commits/${branch}",`
        `"commit": "https://git.corporate-url.com/${repo}/commit/${id}",`
        `"file": "https://git.corporate-url.com/${repo}?path=${file}${line}",`
        `"fileInBranch": "https://git.corporate-url.com/${repo}/blob/${branch}/${file}${line}",`
        `"fileInCommit": "https://git.corporate-url.com/${repo}/blob/${id}/${file}${line}",`
        `"fileLine": "#L${line}",`
        `"fileRange": "#L${start}-L${end}"`
        `}`
    `}]`

Example:
`"gitlens.remotes": [{`
    `"domain": "git.corporate-url.com",`
    `"type": "Custom",`
    `"name": "My Company",`
    `"protocol": "https",`
    `"urls": {`
        `"repository": "https://git.corporate-url.com/projects/${repoBase}/repos/${repoPath}",`
        `"branches": "https://git.corporate-url.com/projects/${repoBase}/repos/${repoPath}/branches",`
        `"branch": "https://git.corporate-url.com/projects/${repoBase}/repos/${repoPath}/commits/${branch}",`
        `"commit": "https://git.corporate-url.com/projects/${repoBase}/repos/${repoPath}/commit/${id}",`
        `"file": "https://git.corporate-url.com/projects/${repoBase}/repos/${repoPath}?path=${file}${line}",`
        `"fileInBranch": "https://git.corporate-url.com/projects/${repoBase}/repos/${repoPath}/blob/${branch}/${file}${line}",`
        `"fileInCommit": "https://git.corporate-url.com/projects/${repoBase}/repos/${repoPath}/blob/${id}/${file}${line}",`
        `"fileLine": "#L${line}",`
        `"fileRange": "#L${start}-L${end}"`
        `}`
    `}]` | +| Name | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `gitlens.integrations.enabled` | Specifies whether to enable rich integrations with any supported remote services | +| `gitlens.remotes` | Specifies custom remote services to be matched with Git remotes to detect custom domains for built-in remote services or provide support for custom remote services

Supported Types (e.g. `"type": "GitHub"`):Example:
`"gitlens.remotes": [{ "domain": "git.corporate-url.com", "type": "GitHub" }]`

Example:
`"gitlens.remotes": [{ "regex": "ssh:\/\/(my\.company\.com):1234\/git\/(.+)", "type": "GitHub" }]`

Example:
`"gitlens.remotes": [{`
    `"domain": "git.corporate-url.com",`
    `"type": "Custom",`
    `"name": "My Company",`
    `"protocol": "https",`
    `"urls": {`
        `"repository": "https://git.corporate-url.com/${repo}",`
        `"branches": "https://git.corporate-url.com/${repo}/branches",`
        `"branch": "https://git.corporate-url.com/${repo}/commits/${branch}",`
        `"commit": "https://git.corporate-url.com/${repo}/commit/${id}",`
        `"file": "https://git.corporate-url.com/${repo}?path=${file}${line}",`
        `"fileInBranch": "https://git.corporate-url.com/${repo}/blob/${branch}/${file}${line}",`
        `"fileInCommit": "https://git.corporate-url.com/${repo}/blob/${id}/${file}${line}",`
        `"fileLine": "#L${line}",`
        `"fileRange": "#L${start}-L${end}"`
        `}`
    `}]`

Example:
`"gitlens.remotes": [{`
    `"regex": "ssh:\/\/(my\.company\.com):1234\/git\/(.+)",`
    `"type": "Custom",`
    `"name": "My Company",`
    `"protocol": "https",`
    `"urls": {`
        `"repository": "https://my.company.com/projects/${repoBase}/repos/${repoPath}",`
        `"branches": "https://my.company.com/projects/${repoBase}/repos/${repoPath}/branches",`
        `"branch": "https://my.company.com/projects/${repoBase}/repos/${repoPath}/commits/${branch}",`
        `"commit": "https://my.company.com/projects/${repoBase}/repos/${repoPath}/commit/${id}",`
        `"file": "https://my.company.com/projects/${repoBase}/repos/${repoPath}?path=${file}${line}",`
        `"fileInBranch": "https://my.company.com/projects/${repoBase}/repos/${repoPath}/blob/${branch}/${file}${line}",`
        `"fileInCommit": "https://my.company.com/projects/${repoBase}/repos/${repoPath}/blob/${id}/${file}${line}",`
        `"fileLine": "#L${line}",`
        `"fileRange": "#L${start}-L${end}"`
        `}`
    `}]` | ## Date & Time Settings [#](#date--time-settings- 'Date & Time Settings') diff --git a/package.json b/package.json index f4f4e6281d64b..527ecb5554a89 100644 --- a/package.json +++ b/package.json @@ -1491,11 +1491,11 @@ }, "domain": { "type": "string", - "description": "Specifies the domain name of the custom remote service" + "description": "Specifies the domain name used to match this custom configuration to a Git remote" }, "regex": { "type": "string", - "description": "Specifies a regular expression to capture the \"domain name\" and \"path\" of the custom remote service" + "description": "Specifies a regular expression used to match this custom configuration to a Git remote and capture the \"domain name\" and \"path\"" }, "name": { "type": "string", @@ -1562,7 +1562,7 @@ } }, "uniqueItems": true, - "markdownDescription": "Specifies user-defined remote (code-hosting) services or custom domains for built-in remote services", + "markdownDescription": "Specifies custom remote services to be matched with Git remotes to detect custom domains for built-in remote services or provide support for custom remote services", "scope": "resource" }, "gitlens.showWelcomeOnInstall": { diff --git a/src/git/parsers/remoteParser.ts b/src/git/parsers/remoteParser.ts index 5931b294c9a6f..98c5bd75c7172 100644 --- a/src/git/parsers/remoteParser.ts +++ b/src/git/parsers/remoteParser.ts @@ -53,7 +53,7 @@ export class GitRemoteParser { static parse( data: string, repoPath: string, - providerFactory: (domain: string, path: string) => RemoteProvider | undefined, + providerFactory: (url: string, domain: string, path: string) => RemoteProvider | undefined, ): GitRemote[] | undefined { if (!data) return undefined; @@ -86,7 +86,7 @@ export class GitRemoteParser { uniqueness = `${domain ? `${domain}/` : ''}${path}`; remote = groups[uniqueness]; if (remote === undefined) { - const provider = providerFactory(domain, path); + const provider = providerFactory(url, domain, path); remote = new GitRemote( repoPath, diff --git a/src/git/remotes/factory.ts b/src/git/remotes/factory.ts index c0cca5d721cfd..ae39174025c89 100644 --- a/src/git/remotes/factory.ts +++ b/src/git/remotes/factory.ts @@ -61,11 +61,13 @@ const builtInProviders: RemoteProviders = [ ]; export class RemoteProviderFactory { - static factory(providers: RemoteProviders): (domain: string, path: string) => RemoteProvider | undefined { - return (domain: string, path: string) => this.create(providers, domain, path); + static factory( + providers: RemoteProviders, + ): (url: string, domain: string, path: string) => RemoteProvider | undefined { + return (url: string, domain: string, path: string) => this.create(providers, url, domain, path); } - static create(providers: RemoteProviders, domain: string, path: string): RemoteProvider | undefined { + static create(providers: RemoteProviders, url: string, domain: string, path: string): RemoteProvider | undefined { try { const key = domain.toLowerCase(); for (const { custom, matcher, creator } of providers) { @@ -78,7 +80,7 @@ export class RemoteProviderFactory { if (matcher.test(key)) return creator(domain, path); if (!custom) continue; - const match = matcher.exec(`${domain}/${path}`); + const match = matcher.exec(url); if (match != null) { return creator(match[1], match[2]); }