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