11import type { RemotesConfig } from '../../config' ;
22import { SelfHostedIntegrationId } from '../../constants.integrations' ;
33import type { Container } from '../../container' ;
4- import type { CloudIntegrationConnection } from '../../plus/integrations/authentication/models' ;
5- import { toIntegrationId } from '../../plus/integrations/authentication/models' ;
4+ import type { ConfiguredProviderAuthenticationDescriptor } from '../../plus/integrations/authentication/models' ;
65import { Logger } from '../../system/logger' ;
76import { configuration } from '../../system/vscode/configuration' ;
87import { AzureDevOpsRemote } from './azure-devops' ;
@@ -78,7 +77,7 @@ const builtInProviders: RemoteProviders = [
7877
7978export function loadRemoteProviders (
8079 cfg : RemotesConfig [ ] | null | undefined ,
81- connectedIntegrations : CloudIntegrationConnection [ ] | undefined ,
80+ configuredIntegrations ?: ConfiguredProviderAuthenticationDescriptor [ ] ,
8281) : RemoteProviders {
8382 const providers : RemoteProviders = [ ] ;
8483
@@ -103,10 +102,10 @@ export function loadRemoteProviders(
103102 }
104103 }
105104
106- if ( connectedIntegrations ?. length ) {
107- for ( const ci of connectedIntegrations ) {
108- if ( toIntegrationId [ ci . provider ] === SelfHostedIntegrationId . CloudGitHubEnterprise ) {
109- const matcher = new URL ( ci . domain ) . host . toLocaleLowerCase ( ) ;
105+ if ( configuredIntegrations ?. length ) {
106+ for ( const ci of configuredIntegrations ) {
107+ if ( ci . integrationId === SelfHostedIntegrationId . CloudGitHubEnterprise && ci . domain ) {
108+ const matcher = ci . domain . toLocaleLowerCase ( ) ;
110109 const providerCreator = ( _container : Container , domain : string , path : string ) =>
111110 new GitHubRemote ( domain , path ) ;
112111 const provider = {
@@ -165,14 +164,15 @@ function getCustomProviderCreator(cfg: RemotesConfig) {
165164 }
166165}
167166
168- export async function getRemoteProviderMatcher (
167+ export function getRemoteProviderMatcher (
169168 container : Container ,
170169 providers ?: RemoteProviders ,
171- ) : Promise < ( url : string , domain : string , path : string ) => RemoteProvider | undefined > {
170+ ) : ( url : string , domain : string , path : string ) => RemoteProvider | undefined {
172171 if ( providers == null ) {
173- const ci = await container . cloudIntegrations ;
174- const c = await ci ?. getConnections ( ) ;
175- providers = loadRemoteProviders ( configuration . get ( 'remotes' , null ) , c ) ;
172+ providers = loadRemoteProviders (
173+ configuration . get ( 'remotes' , null ) ,
174+ container . integrations . getConfiguredIntegrationDescriptors ( ) ,
175+ ) ;
176176 }
177177
178178 return ( url : string , domain : string , path : string ) =>
0 commit comments