Path: blob/main/extensions/copilot/src/extension/chatSessions/common/chatSessionWorkspaceFolderService.ts
13399 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import type * as vscode from 'vscode';6import { createServiceIdentifier } from '../../../util/common/services';7import { RepositoryProperties, WorkspaceFolderEntry } from './chatSessionMetadataStore';8import { ChatSessionWorktreeFile } from './chatSessionWorktreeService';910export const IChatSessionWorkspaceFolderService = createServiceIdentifier<IChatSessionWorkspaceFolderService>('IChatSessionWorkspaceFolderService');1112/**13* Service for tracking workspace folder selections for chat sessions.14* This is used in multi-root workspaces where some folders may not have git repositories.15* In such cases, we track the workspace folder URI instead of a git repository.16*/17export interface IChatSessionWorkspaceFolderService {18readonly _serviceBrand: undefined;19/**20* Triggered when the set of changes in a session workspace folder has changed.21*/22onDidChangeWorkspaceFolderChanges: vscode.Event<{ sessionId: string }>;23deleteTrackedWorkspaceFolder(sessionId: string): Promise<void>;24/**25* Track workspace folder selection for a session (for folders without git repos in multi-root workspaces)26*/27trackSessionWorkspaceFolder(sessionId: string, workspaceFolderUri: string, repositoryProperties?: RepositoryProperties): Promise<void>;2829/**30* Get the workspace folder associated with a session (if a workspace folder without git repo was selected)31*/32getSessionWorkspaceFolder(sessionId: string): Promise<vscode.Uri | undefined>;3334/**35* Get the workspace folder entry associated with a session (if a workspace folder without git repo was selected)36*/37getSessionWorkspaceFolderEntry(sessionId: string): Promise<WorkspaceFolderEntry | undefined>;3839/**40* Get the repository properties associated with a session.41*/42getRepositoryProperties(sessionId: string): Promise<RepositoryProperties | undefined>;4344/**45* Handle the completion of a request for a session.46*/47handleRequestCompleted(sessionId: string): Promise<void>;4849/**50* Get the changes in the workspace folder for a session.51*/52getWorkspaceChanges(sessionId: string): Promise<readonly ChatSessionWorktreeFile[] | undefined>;5354/**55* Clear the cached changes for a session.56* Returns the affected session IDs.57*/58clearWorkspaceChanges(sessionId: string): string[];5960/**61* Clear cached changes for all sessions associated with a workspace folder.62* Returns the affected session IDs.63*/64clearWorkspaceChanges(folderUri: vscode.Uri): string[];6566hasCachedChanges(sessionId: string): Promise<boolean>;67}686970