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