Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ export interface IChatSessionWorkspaceFolderService {
*/
handleRequestCompleted(sessionId: string): Promise<void>;

/**
* Refresh the changes in the workspace folder for a session.
*/
refreshWorkspaceChanges(sessionId: string): Promise<void>;

/**
* Get the changes in the workspace folder for a session.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export interface IChatSessionWorktreeService {

getWorktreeChanges(sessionId: string): Promise<readonly vscode.ChatSessionChangedFile[] | undefined>;

refreshWorktreeChanges(sessionId: string): Promise<void>;

hasCachedChanges(sessionId: string): Promise<boolean>;

handleRequestCompleted(sessionId: string): Promise<void>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ export class ChatSessionWorkspaceFolderService extends Disposable implements ICh
return !!cachedChanges;
}

async refreshWorkspaceChanges(sessionId: string): Promise<void> {
// Clear the cache
this.clearWorkspaceChanges(sessionId);

// Populate the cache
await this.getWorkspaceChanges(sessionId);
Comment thread
lszomoru marked this conversation as resolved.
}

async getWorkspaceChanges(sessionId: string): Promise<readonly ChatSessionWorktreeFile[] | undefined> {
return this.workspaceChangesSequencer.queue(sessionId, async () => {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,22 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
return !!worktreeProperties.changes;
}

async refreshWorktreeChanges(sessionId: string): Promise<void> {
const worktreeProperties = await this.getWorktreeProperties(sessionId);
if (!worktreeProperties || typeof worktreeProperties === 'string') {
return;
}

// Clear the cache
await this.setWorktreeProperties(sessionId, {
...worktreeProperties,
changes: undefined
});

// Populate the cache
await this.getWorktreeChanges(sessionId);
Comment thread
lszomoru marked this conversation as resolved.
}

async getWorktreeChanges(sessionId: string): Promise<readonly vscode.ChatSessionChangedFile[] | undefined> {
const worktreeProperties = await this.getWorktreeProperties(sessionId);
if (!worktreeProperties || typeof worktreeProperties === 'string') {
Expand Down
2 changes: 2 additions & 0 deletions extensions/copilot/test/e2e/cli.stest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ async function registerChatServices(testingServiceCollection: TestingServiceColl
async getRepositoryProperties() { return undefined; },
async setRepositoryProperties() { },
async handleRequestCompleted() { },
async refreshWorkspaceChanges() { },
async getWorkspaceChanges() { return undefined; },
async hasCachedChanges() { return false; },
clearWorkspaceChanges() { return []; },
Expand All @@ -218,6 +219,7 @@ async function registerChatServices(testingServiceCollection: TestingServiceColl
async getWorktreePath() { return undefined; },
async applyWorktreeChanges() { },
async getSessionIdForWorktree() { return undefined; },
async refreshWorktreeChanges() { },
async getWorktreeChanges() { return undefined; },
async handleRequestCompleted() { },
async getAdditionalWorktreeProperties() { return []; },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ registerAction2(class MarkSessionAsDoneAction extends Action2 {
IsSessionsWindowContext,
IsActiveSessionArchivedContext.negate(),
ActiveSessionContextKeys.HasGitRepository.isEqualTo(true),
ActiveSessionContextKeys.HasGitOperationInProgress.negate(),
ContextKeyExpr.or(
// No changes
ActiveSessionContextKeys.HasBranchChanges.negate(),
Expand Down
Loading