diff --git a/src/container.ts b/src/container.ts index b68e9c0..7b64e70 100644 --- a/src/container.ts +++ b/src/container.ts @@ -297,7 +297,7 @@ export class Container { this._disposables.push(this._git.register(provider.descriptor.id, provider)); } - this._git.registrationComplete(); + await this._git.registrationComplete(); } private onAnyConfigurationChanged(e: ConfigurationChangeEvent) { diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index 1773153..ac350be 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -10,6 +10,7 @@ import type { WorkspaceFoldersChangeEvent, } from 'vscode'; import { Disposable, EventEmitter, FileType, ProgressLocation, Uri, window, workspace } from 'vscode'; +import { isWeb } from '@env/platform'; import { resetAvatarCache } from '../avatars'; import type { CoreGitConfiguration } from '../constants'; import { GlyphChars, Schemes } from '../constants'; @@ -494,14 +495,24 @@ export class GitProviderService implements Disposable { private _initializing: boolean = true; @log({ singleLine: true }) - registrationComplete() { + async registrationComplete() { const scope = getLogScope(); this._initializing = false; - const { workspaceFolders } = workspace; + let { workspaceFolders } = workspace; if (workspaceFolders?.length) { - void this.discoverRepositories(workspaceFolders); + await this.discoverRepositories(workspaceFolders); + + // This is a hack to work around some issue with remote repositories on the web not being discovered on the initial load + if (this.repositoryCount === 0 && isWeb) { + setTimeout(() => { + ({ workspaceFolders } = workspace); + if (workspaceFolders?.length) { + void this.discoverRepositories(workspaceFolders, { force: true }); + } + }, 1000); + } } else { this.updateContext(); }