Skip to content

Commit 652b31d

Browse files
authored
set repository for cloud sessions (#298395)
1 parent 90127b7 commit 652b31d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/vs/sessions/contrib/sessions/browser/sessionsManagementService.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { AgentSessionProviders } from '../../../../workbench/contrib/chat/browse
2323
import { INewSession, LocalNewSession, RemoteNewSession } from '../../chat/browser/newSession.js';
2424
import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js';
2525
import { ILanguageModelsService } from '../../../../workbench/contrib/chat/common/languageModels.js';
26+
import { GITHUB_REMOTE_FILE_SCHEME } from '../../fileTreeView/browser/githubFileSystemProvider.js';
2627

2728
export const IsNewChatSessionContext = new RawContextKey<boolean>('isNewChatSession', true);
2829

@@ -186,11 +187,16 @@ export class SessionsManagementService extends Disposable implements ISessionsMa
186187
}
187188
}
188189

189-
private getRepositoryFromMetadata(metadata: { readonly [key: string]: unknown } | undefined): [URI | undefined, URI | undefined] {
190+
private getRepositoryFromMetadata(session: IAgentSession): [URI | undefined, URI | undefined] {
191+
const metadata = session.metadata;
190192
if (!metadata) {
191193
return [undefined, undefined];
192194
}
193195

196+
if (session.providerType === AgentSessionProviders.Cloud) {
197+
return [URI.parse(`${GITHUB_REMOTE_FILE_SCHEME}://github/${metadata.owner}/${metadata.name}`), undefined];
198+
}
199+
194200
const repositoryPath = metadata?.repositoryPath as string | undefined;
195201
const repositoryPathUri = typeof repositoryPath === 'string' ? URI.file(repositoryPath) : undefined;
196202

@@ -404,7 +410,7 @@ export class SessionsManagementService extends Disposable implements ISessionsMa
404410
if (session) {
405411
if (isAgentSession(session)) {
406412
this.lastSelectedSession = session.resource;
407-
const [repository, worktree] = this.getRepositoryFromMetadata(session.metadata);
413+
const [repository, worktree] = this.getRepositoryFromMetadata(session);
408414
activeSessionItem = {
409415
isUntitled: this.chatService.getSession(session.resource)?.contributedChatSession?.isUntitled ?? true,
410416
label: session.label,

0 commit comments

Comments
 (0)