From b2bb4f85a5b4f810b7628ec2c8c71f2c9071d60f Mon Sep 17 00:00:00 2001 From: Ramin Tadayon <67011668+axosoft-ramint@users.noreply.github.com> Date: Mon, 28 Aug 2023 03:32:29 -0700 Subject: [PATCH] Exposes isDiscoveringRepositories and has deep link service await it (#2886) --- src/git/gitProviderService.ts | 3 +++ src/uris/deepLinks/deepLinkService.ts | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index 7e697bd..e1ee276 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -582,6 +582,9 @@ export class GitProviderService implements Disposable { private _discoveredWorkspaceFolders = new Map>(); private _isDiscoveringRepositories: Promise | undefined; + get isDiscoveringRepositories(): Promise | undefined { + return this._isDiscoveringRepositories; + } @log({ args: { 0: folders => folders.length } }) async discoverRepositories(folders: readonly WorkspaceFolder[], options?: { force?: boolean }): Promise { diff --git a/src/uris/deepLinks/deepLinkService.ts b/src/uris/deepLinks/deepLinkService.ts index f7f224b..c5d65ce 100644 --- a/src/uris/deepLinks/deepLinkService.ts +++ b/src/uris/deepLinks/deepLinkService.ts @@ -44,6 +44,10 @@ export class DeepLinkService implements Disposable { if (link == null) return; if (this._context.state === DeepLinkServiceState.Idle) { + if (this.container.git.isDiscoveringRepositories) { + await this.container.git.isDiscoveringRepositories; + } + if (!link.type || (!link.repoId && !link.remoteUrl && !link.repoPath)) { void window.showErrorMessage('Unable to resolve link'); Logger.warn(`Unable to resolve link - missing basic properties: ${uri.toString()}`); @@ -126,6 +130,10 @@ export class DeepLinkService implements Disposable { let action = DeepLinkServiceAction.OpenRepo; + if (this.container.git.isDiscoveringRepositories) { + await this.container.git.isDiscoveringRepositories; + } + if (pendingDeepLink.repoPath != null) { const repoOpenUri = Uri.parse(pendingDeepLink.repoPath); try {