|
|
@ -7,6 +7,7 @@ import { RemoteResourceType } from '../../git/models/remoteResource'; |
|
|
|
import { Repository } from '../../git/models/repository'; |
|
|
|
import { showRepositoriesPicker } from '../../quickpicks/repositoryPicker'; |
|
|
|
import { SubscriptionState } from '../../subscription'; |
|
|
|
import { log } from '../../system/decorators/log'; |
|
|
|
import { normalizePath } from '../../system/path'; |
|
|
|
import { openWorkspace, OpenWorkspaceLocation } from '../../system/utils'; |
|
|
|
import type { ServerConnection } from '../gk/serverConnection'; |
|
|
@ -202,6 +203,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
return this._localWorkspaces?.find(workspace => workspace.id === workspaceId); |
|
|
|
} |
|
|
|
|
|
|
|
@log() |
|
|
|
async getWorkspaces(options?: { excludeRepositories?: boolean; force?: boolean }): Promise<GetWorkspacesResponse> { |
|
|
|
const getWorkspacesResponse: GetWorkspacesResponse = { |
|
|
|
cloudWorkspaces: [], |
|
|
@ -244,6 +246,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
return descriptors?.map(d => ({ ...d, workspaceId: workspaceId })) ?? []; |
|
|
|
} |
|
|
|
|
|
|
|
@log() |
|
|
|
async addMissingCurrentWorkspaceRepos(options?: { force?: boolean }): Promise<void> { |
|
|
|
if (this._currentWorkspaceId == null) return; |
|
|
|
let currentWorkspace = [...(this._cloudWorkspaces ?? []), ...(this._localWorkspaces ?? [])].find( |
|
|
@ -364,6 +367,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@log() |
|
|
|
resetWorkspaces(options?: { cloud?: boolean; local?: boolean }) { |
|
|
|
if (options?.cloud ?? true) { |
|
|
|
this._cloudWorkspaces = undefined; |
|
|
@ -444,6 +448,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
// eslint-disable-next-line @typescript-eslint/unified-signatures
|
|
|
|
repository: Repository, |
|
|
|
): Promise<void>; |
|
|
|
@log({ args: { 1: false, 2: false } }) |
|
|
|
async locateWorkspaceRepo( |
|
|
|
workspaceId: string, |
|
|
|
descriptor: CloudWorkspaceRepositoryDescriptor | LocalWorkspaceRepositoryDescriptor, |
|
|
@ -511,6 +516,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@log({ args: false }) |
|
|
|
async createCloudWorkspace(options?: { repos?: Repository[] }): Promise<void> { |
|
|
|
const input = window.createInputBox(); |
|
|
|
input.title = 'Create Cloud Workspace'; |
|
|
@ -754,6 +760,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@log() |
|
|
|
async deleteCloudWorkspace(workspaceId: string) { |
|
|
|
const confirmation = await window.showWarningMessage( |
|
|
|
`Are you sure you want to delete this workspace? This cannot be undone.`, |
|
|
@ -797,6 +804,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
return repos.filter(repo => !workspaceRepos.find(r => r.id === repo.id)); |
|
|
|
} |
|
|
|
|
|
|
|
@log({ args: { 1: false } }) |
|
|
|
async addCloudWorkspaceRepos( |
|
|
|
workspaceId: string, |
|
|
|
options?: { repos?: Repository[]; suppressNotifications?: boolean }, |
|
|
@ -966,6 +974,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@log({ args: { 1: false } }) |
|
|
|
async removeCloudWorkspaceRepo(workspaceId: string, descriptor: CloudWorkspaceRepositoryDescriptor) { |
|
|
|
const workspace = this.getCloudWorkspace(workspaceId); |
|
|
|
if (workspace == null) return; |
|
|
@ -1008,6 +1017,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
usePathMapping?: boolean; |
|
|
|
}, |
|
|
|
): Promise<WorkspaceRepositoriesByName>; |
|
|
|
@log({ args: { 1: false } }) |
|
|
|
async resolveWorkspaceRepositoriesByName( |
|
|
|
workspaceOrId: CloudWorkspace | LocalWorkspace | string, |
|
|
|
options?: { |
|
|
@ -1104,6 +1114,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
return workspaceRepositoriesByName; |
|
|
|
} |
|
|
|
|
|
|
|
@log() |
|
|
|
async saveAsCodeWorkspaceFile(workspaceId: string): Promise<void> { |
|
|
|
const workspace = this.getCloudWorkspace(workspaceId) ?? this.getLocalWorkspace(workspaceId); |
|
|
|
if (workspace == null) return; |
|
|
@ -1181,6 +1192,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
void this.openCodeWorkspaceFile(workspaceId, { location: open.location }); |
|
|
|
} |
|
|
|
|
|
|
|
@log() |
|
|
|
async chooseCodeWorkspaceAutoAddSetting(options?: { current?: boolean }): Promise<WorkspaceAutoAddSetting> { |
|
|
|
if ( |
|
|
|
options?.current && |
|
|
@ -1241,6 +1253,7 @@ export class WorkspacesService implements Disposable { |
|
|
|
return newWorkspaceAutoAddSetting; |
|
|
|
} |
|
|
|
|
|
|
|
@log() |
|
|
|
async openCodeWorkspaceFile(workspaceId: string, options?: { location?: OpenWorkspaceLocation }): Promise<void> { |
|
|
|
const workspace = this.getCloudWorkspace(workspaceId) ?? this.getLocalWorkspace(workspaceId); |
|
|
|
if (workspace == null) return; |
|
|
|