Skip to content

Commit e0d5db5

Browse files
Welcome View: repository picker for background sessions (#3103)
* Untitled repository picker for background sessions * Updates * updates * Include just what we need * Fodler picker with verification of trust * Fix tests --------- Co-authored-by: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com>
1 parent 08de31b commit e0d5db5

18 files changed

Lines changed: 445 additions & 85 deletions

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@
141141
"contribEditorContentMenu",
142142
"chatPromptFiles",
143143
"mcpServerDefinitions",
144-
"tabInputMultiDiff"
144+
"tabInputMultiDiff",
145+
"workspaceTrust"
145146
],
146147
"contributes": {
147148
"languageModelTools": [
@@ -2140,6 +2141,12 @@
21402141
"icon": "$(terminal)",
21412142
"category": "Copilot CLI"
21422143
},
2144+
{
2145+
"command": "github.copilot.cli.sessions.openRepository",
2146+
"title": "%github.copilot.command.cli.sessions.openRepository%",
2147+
"icon": "$(folder-opened)",
2148+
"category": "Copilot CLI"
2149+
},
21432150
{
21442151
"command": "github.copilot.chat.replay",
21452152
"title": "Start Chat Replay",
@@ -4527,6 +4534,10 @@
45274534
"command": "github.copilot.cli.sessions.resumeInTerminal",
45284535
"when": "false"
45294536
},
4537+
{
4538+
"command": "github.copilot.cli.sessions.openRepository",
4539+
"when": "false"
4540+
},
45304541
{
45314542
"command": "github.copilot.cloud.sessions.openInBrowser",
45324543
"when": "false"

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@
377377
"github.copilot.config.nextEditSuggestions.preferredModel": "Preferred model for next edit suggestions.",
378378
"github.copilot.command.deleteAgentSession": "Delete...",
379379
"github.copilot.command.cli.sessions.resumeInTerminal": "Resume in Terminal",
380+
"github.copilot.command.cli.sessions.openRepository": "Open Repository",
380381
"github.copilot.command.openCopilotAgentSessionsInBrowser": "Open in Browser",
381382
"github.copilot.command.closeChatSessionPullRequest.title": "Close Pull Request",
382383
"github.copilot.command.installPRExtension.title": "Install GitHub Pull Request Extension",

src/extension/chatSessions/common/chatSessionWorkspaceFolderService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const IChatSessionWorkspaceFolderService = createServiceIdentifier<IChatS
1515
*/
1616
export interface IChatSessionWorkspaceFolderService {
1717
readonly _serviceBrand: undefined;
18+
getRecentFolders(): { folder: vscode.Uri; lastAccessTime: number }[];
1819
deleteTrackedWorkspaceFolder(sessionId: string): Promise<void>;
1920
/**
2021
* Track workspace folder selection for a session (for folders without git repos in multi-root workspaces)

src/extension/chatSessions/vscode-node/chatSessionWorkspaceFolderServiceImpl.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ export class ChatSessionWorkspaceFolderService extends Disposable implements ICh
9292
this.logService.trace(`[ChatSessionWorkspaceFolderService] Cleaned up old entries, kept ${entriesToKeep.length}`);
9393
}
9494

95+
public getRecentFolders(): { folder: vscode.Uri; lastAccessTime: number }[] {
96+
const data = this.extensionContext.globalState.get<Record<string, WorkspaceFolderEntry>>(CHAT_SESSION_WORKSPACE_FOLDER_MEMENTO_KEY, {});
97+
const recentFolders: { folder: vscode.Uri; lastAccessTime: number }[] = [];
98+
for (const entry of Object.values(data)) {
99+
if (typeof entry === 'string') {
100+
continue;
101+
}
102+
if (isUntitledSessionId(entry.folderPath)) {
103+
continue; // Skip untitled sessions that may have been saved.
104+
}
105+
recentFolders.push({ folder: vscode.Uri.file(entry.folderPath), lastAccessTime: entry.timestamp });
106+
}
107+
recentFolders.sort((a, b) => b.lastAccessTime - a.lastAccessTime);
108+
return recentFolders;
109+
}
95110
async deleteTrackedWorkspaceFolder(sessionId: string): Promise<void> {
96111
this._sessionWorkspaceFolders.delete(sessionId);
97112
const data = this.extensionContext.globalState.get<Record<string, WorkspaceFolderEntry>>(CHAT_SESSION_WORKSPACE_FOLDER_MEMENTO_KEY, {});

src/extension/chatSessions/vscode-node/chatSessions.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ export class ChatSessionsContrib extends Disposable implements IExtensionContrib
134134

135135
const copilotcliChatSessionParticipant = this._register(copilotcliAgentInstaService.createInstance(
136136
CopilotCLIChatSessionParticipant,
137-
copilotcliSessionIsolationManager,
138137
copilotcliChatSessionContentProvider,
139138
promptResolver,
140139
copilotcliSessionItemProvider,
@@ -145,7 +144,7 @@ export class ChatSessionsContrib extends Disposable implements IExtensionContrib
145144
const copilotCLIWorkspaceFolderSessions = copilotcliAgentInstaService.invokeFunction(accessor => accessor.get(IChatSessionWorkspaceFolderService));
146145
const copilotcliParticipant = vscode.chat.createChatParticipant(this.copilotcliSessionType, copilotcliChatSessionParticipant.createHandler());
147146
this._register(vscode.chat.registerChatSessionContentProvider(this.copilotcliSessionType, copilotcliChatSessionContentProvider, copilotcliParticipant));
148-
this._register(registerCLIChatCommands(copilotcliSessionItemProvider, copilotCLISessionService, copilotCLIWorktreeManagerService, gitService, copilotCLIWorkspaceFolderSessions));
147+
this._register(registerCLIChatCommands(copilotcliSessionItemProvider, copilotCLISessionService, copilotCLIWorktreeManagerService, gitService, copilotCLIWorkspaceFolderSessions, copilotcliChatSessionContentProvider));
149148
}
150149

151150
private registerCopilotCloudAgent() {

0 commit comments

Comments
 (0)