|
@ -50,6 +50,7 @@ export class WorkspacesService implements Disposable { |
|
|
private _workspacesPathProvider: WorkspacesPathMappingProvider; |
|
|
private _workspacesPathProvider: WorkspacesPathMappingProvider; |
|
|
private _currentWorkspaceId: string | undefined; |
|
|
private _currentWorkspaceId: string | undefined; |
|
|
private _currentWorkspaceAutoAddSetting: WorkspaceAutoAddSetting = WorkspaceAutoAddSetting.Disabled; |
|
|
private _currentWorkspaceAutoAddSetting: WorkspaceAutoAddSetting = WorkspaceAutoAddSetting.Disabled; |
|
|
|
|
|
private _currentWorkspace: CloudWorkspace | LocalWorkspace | undefined; |
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
|
private readonly container: Container, |
|
|
private readonly container: Container, |
|
@ -75,6 +76,10 @@ export class WorkspacesService implements Disposable { |
|
|
return this._currentWorkspaceId; |
|
|
return this._currentWorkspaceId; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get currentWorkspace(): CloudWorkspace | LocalWorkspace | undefined { |
|
|
|
|
|
return this._currentWorkspace; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private onSubscriptionChanged(event: SubscriptionChangeEvent): void { |
|
|
private onSubscriptionChanged(event: SubscriptionChangeEvent): void { |
|
|
if ( |
|
|
if ( |
|
|
event.current.account == null || |
|
|
event.current.account == null || |
|
@ -211,6 +216,15 @@ export class WorkspacesService implements Disposable { |
|
|
getWorkspacesResponse.localWorkspaceInfo = loadLocalWorkspacesResponse.localWorkspaceInfo; |
|
|
getWorkspacesResponse.localWorkspaceInfo = loadLocalWorkspacesResponse.localWorkspaceInfo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const currentWorkspace = [...(this._cloudWorkspaces ?? []), ...(this._localWorkspaces ?? [])].find( |
|
|
|
|
|
workspace => workspace.current, |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (currentWorkspace != null) { |
|
|
|
|
|
this._currentWorkspaceId = currentWorkspace.id; |
|
|
|
|
|
this._currentWorkspace = currentWorkspace; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
getWorkspacesResponse.cloudWorkspaces = this._cloudWorkspaces ?? []; |
|
|
getWorkspacesResponse.cloudWorkspaces = this._cloudWorkspaces ?? []; |
|
|
getWorkspacesResponse.localWorkspaces = this._localWorkspaces ?? []; |
|
|
getWorkspacesResponse.localWorkspaces = this._localWorkspaces ?? []; |
|
|
|
|
|
|
|
@ -261,11 +275,13 @@ export class WorkspacesService implements Disposable { |
|
|
|
|
|
|
|
|
if ( |
|
|
if ( |
|
|
(!options?.force && this._currentWorkspaceAutoAddSetting === WorkspaceAutoAddSetting.Disabled) || |
|
|
(!options?.force && this._currentWorkspaceAutoAddSetting === WorkspaceAutoAddSetting.Disabled) || |
|
|
!currentWorkspace.current |
|
|
|
|
|
|
|
|
!currentWorkspace?.current |
|
|
) { |
|
|
) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this._currentWorkspace = currentWorkspace; |
|
|
|
|
|
|
|
|
if (!(await currentWorkspace.getRepositoryDescriptors())?.length) return; |
|
|
if (!(await currentWorkspace.getRepositoryDescriptors())?.length) return; |
|
|
|
|
|
|
|
|
const repositories = [ |
|
|
const repositories = [ |
|
@ -281,7 +297,12 @@ export class WorkspacesService implements Disposable { |
|
|
currentWorkspaceRepositoryIdMap.set(repository.id, repository); |
|
|
currentWorkspaceRepositoryIdMap.set(repository.id, repository); |
|
|
} |
|
|
} |
|
|
const repositoriesToAdd = repositories.filter(r => !currentWorkspaceRepositoryIdMap.has(r.id)); |
|
|
const repositoriesToAdd = repositories.filter(r => !currentWorkspaceRepositoryIdMap.has(r.id)); |
|
|
if (repositoriesToAdd.length === 0) return; |
|
|
|
|
|
|
|
|
if (repositoriesToAdd.length === 0) { |
|
|
|
|
|
if (options?.force) { |
|
|
|
|
|
void window.showInformationMessage('No new repositories found to add.', { modal: true }); |
|
|
|
|
|
} |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
let chosenRepoPaths: string[] = []; |
|
|
let chosenRepoPaths: string[] = []; |
|
|
if (!options?.force && this._currentWorkspaceAutoAddSetting === WorkspaceAutoAddSetting.Prompt) { |
|
|
if (!options?.force && this._currentWorkspaceAutoAddSetting === WorkspaceAutoAddSetting.Prompt) { |
|
|
const addChoice = await window.showInformationMessage( |
|
|
const addChoice = await window.showInformationMessage( |
|
|