Skip to content

Commit 9893e0e

Browse files
committed
Updates (minor) from code review
1 parent fb6f815 commit 9893e0e

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

docs/telemetry-events.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ or
319319
```typescript
320320
{
321321
'hostingProvider.key': string,
322-
'hostingProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'gitlab-self-hosted'
322+
'hostingProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'cloud-github-enterprise' | 'gitlab-self-hosted'
323323
}
324324
```
325325

@@ -330,7 +330,7 @@ or
330330
```typescript
331331
{
332332
'hostingProvider.key': string,
333-
'hostingProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'gitlab-self-hosted'
333+
'hostingProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'cloud-github-enterprise' | 'gitlab-self-hosted'
334334
}
335335
```
336336

@@ -341,7 +341,7 @@ or
341341
```typescript
342342
{
343343
'issueProvider.key': string,
344-
'issueProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'gitlab-self-hosted'
344+
'issueProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'cloud-github-enterprise' | 'gitlab-self-hosted'
345345
}
346346
```
347347

@@ -352,7 +352,7 @@ or
352352
```typescript
353353
{
354354
'issueProvider.key': string,
355-
'issueProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'gitlab-self-hosted'
355+
'issueProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'cloud-github-enterprise' | 'gitlab-self-hosted'
356356
}
357357
```
358358

@@ -373,7 +373,7 @@ or
373373
374374
```typescript
375375
{
376-
'integration.id': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello'
376+
'integration.id': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'cloud-github-enterprise' | 'gitlab-self-hosted'
377377
}
378378
```
379379

@@ -1454,7 +1454,7 @@ void
14541454
```typescript
14551455
{
14561456
'hostingProvider.key': string,
1457-
'hostingProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'gitlab-self-hosted',
1457+
'hostingProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'cloud-github-enterprise' | 'gitlab-self-hosted',
14581458
// @deprecated: true
14591459
'remoteProviders.key': string
14601460
}
@@ -1467,7 +1467,7 @@ void
14671467
```typescript
14681468
{
14691469
'hostingProvider.key': string,
1470-
'hostingProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'gitlab-self-hosted',
1470+
'hostingProvider.provider': 'github' | 'gitlab' | 'bitbucket' | 'azureDevOps' | 'jira' | 'trello' | 'github-enterprise' | 'cloud-github-enterprise' | 'gitlab-self-hosted',
14711471
// @deprecated: true
14721472
'remoteProviders.key': string
14731473
}

src/constants.integrations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export type IntegrationId = HostingIntegrationId | IssueIntegrationId | SelfHost
2020

2121
export const supportedOrderedCloudIssueIntegrationIds = [IssueIntegrationId.Jira];
2222
export const supportedOrderedCloudIntegrationIds = [
23-
SelfHostedIntegrationId.CloudGitHubEnterprise,
2423
HostingIntegrationId.GitHub,
24+
SelfHostedIntegrationId.CloudGitHubEnterprise,
2525
HostingIntegrationId.GitLab,
2626
IssueIntegrationId.Jira,
2727
];

src/git/parsers/remoteParser.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ import type { getRemoteProviderMatcher } from '../remotes/remoteProviders';
66

77
const remoteRegex = /^(.*)\t(.*)\s\((.*)\)$/gm;
88

9-
type PromiseType<T> = T extends Promise<infer U> ? U : T;
10-
119
export function parseGitRemotes(
1210
container: Container,
1311
data: string,
1412
repoPath: string,
15-
remoteProviderMatcher: PromiseType<ReturnType<typeof getRemoteProviderMatcher>>,
13+
remoteProviderMatcher: Awaited<ReturnType<typeof getRemoteProviderMatcher>>,
1614
): GitRemote[] {
1715
using sw = maybeStopWatch(`Git.parseRemotes(${repoPath})`, { log: false, logLevel: 'debug' });
1816
if (!data) return [];

src/plus/integrations/integrationService.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ export class IntegrationService implements Disposable {
9191
private async syncCloudIntegrations(forceConnect: boolean) {
9292
const scope = getLogScope();
9393
const connectedIntegrations = new Set<IntegrationId>();
94+
const domainsById = new Map<IntegrationId, string>();
95+
9496
const loggedIn = await this.container.subscription.getAuthenticationSession();
95-
const domains = new Map<string, string>();
9697
if (loggedIn) {
9798
const cloudIntegrations = await this.container.cloudIntegrations;
9899
const connections = await cloudIntegrations?.getConnections();
@@ -106,15 +107,15 @@ export class IntegrationService implements Disposable {
106107
if (p.domain?.length > 0) {
107108
try {
108109
const host = new URL(p.domain).host;
109-
domains.set(integrationId, host);
110+
domainsById.set(integrationId, host);
110111
} catch {
111112
Logger.warn(`Invalid domain for ${integrationId} integration: ${p.domain}. Ignoring.`, scope);
112113
}
113114
}
114115
});
115116
}
116117

117-
for await (const integration of this.getSupportedCloudIntegrations(domains)) {
118+
for await (const integration of this.getSupportedCloudIntegrations(domainsById)) {
118119
await integration.syncCloudConnection(
119120
connectedIntegrations.has(integration.id) ? 'connected' : 'disconnected',
120121
forceConnect,
@@ -132,9 +133,9 @@ export class IntegrationService implements Disposable {
132133
return connectedIntegrations;
133134
}
134135

135-
private async *getSupportedCloudIntegrations(domains: Map<string, string>): AsyncIterable<Integration> {
136+
private async *getSupportedCloudIntegrations(domainsById: Map<IntegrationId, string>): AsyncIterable<Integration> {
136137
for (const id of getSupportedCloudIntegrationIds()) {
137-
if (id === SelfHostedIntegrationId.CloudGitHubEnterprise && !domains.has(id)) {
138+
if (id === SelfHostedIntegrationId.CloudGitHubEnterprise && !domainsById.has(id)) {
138139
try {
139140
// Try getting whatever we have now because we will need to disconnect
140141
yield this.get(id);
@@ -143,7 +144,7 @@ export class IntegrationService implements Disposable {
143144
// because we probably haven't ever had an instance of this integration
144145
}
145146
} else {
146-
yield this.get(id, domains?.get(id));
147+
yield this.get(id, domainsById.get(id));
147148
}
148149
}
149150
}
@@ -594,11 +595,13 @@ export class IntegrationService implements Disposable {
594595
// case 'bitbucket':
595596
// return get(HostingIntegrationId.Bitbucket) as RT;
596597
case 'github':
597-
if (remote.provider.custom && remote.provider.domain != null) {
598-
return get(SelfHostedIntegrationId.GitHubEnterprise, remote.provider.domain) as RT;
599-
}
600598
if (remote.provider.domain != null && !isGitHubDotCom(remote.provider.domain)) {
601-
return get(SelfHostedIntegrationId.CloudGitHubEnterprise, remote.provider.domain) as RT;
599+
return get(
600+
remote.provider.custom
601+
? SelfHostedIntegrationId.GitHubEnterprise
602+
: SelfHostedIntegrationId.CloudGitHubEnterprise,
603+
remote.provider.domain,
604+
) as RT;
602605
}
603606
return get(HostingIntegrationId.GitHub) as RT;
604607
case 'gitlab':

src/plus/integrations/providers/github/sub-providers/remotes.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { configuration } from '../../../../../system/vscode/configuration';
77

88
export class RemotesGitSubProvider extends RemotesGitProviderBase {
99
@log({ args: { 1: false } })
10-
// eslint-disable-next-line @typescript-eslint/require-await
1110
async getRemotes(
1211
repoPath: string | undefined,
1312
_options?: { filter?: (remote: GitRemote) => boolean; sort?: boolean },

0 commit comments

Comments
 (0)