Skip to content

Commit 9a13e1e

Browse files
committed
Revert proposals
1 parent 3606233 commit 9a13e1e

4 files changed

Lines changed: 44 additions & 360 deletions

src/@types/vscode.proposed.chatContextProvider.d.ts

Lines changed: 13 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,16 @@ declare module 'vscode' {
1111
export namespace chat {
1212

1313
/**
14-
* Register a chat workspace context provider. Workspace context is automatically included in all chat requests.
14+
* Register a chat context provider. Chat context can be provided:
15+
* - For a resource. Make sure to pass a selector that matches the resource you want to provide context for.
16+
* Providers registered without a selector will not be called for resource-based context.
17+
* - Explicitly. These context items are shown as options when the user explicitly attaches context.
1518
*
1619
* To ensure your extension is activated when chat context is requested, make sure to include the following activations events:
1720
* - If your extension implements `provideWorkspaceChatContext` or `provideChatContextForResource`, find an activation event which is a good signal to activate.
1821
* Ex: `onLanguage:<languageId>`, `onWebviewPanel:<viewType>`, etc.`
1922
* - If your extension implements `provideChatContextExplicit`, your extension will be automatically activated when the user requests explicit context.
2023
*
21-
* @param id Unique identifier for the provider.
22-
* @param provider The chat workspace context provider.
23-
*/
24-
export function registerChatWorkspaceContextProvider(id: string, provider: ChatWorkspaceContextProvider): Disposable;
25-
26-
/**
27-
* Register a chat explicit context provider. Explicit context items are shown as options when the user explicitly attaches context.
28-
*
29-
* To ensure your extension is activated when chat context is requested, make sure to include the `onChatContextProvider:<id>` activation event in your `package.json`.
30-
*
31-
* @param id Unique identifier for the provider.
32-
* @param provider The chat explicit context provider.
33-
*/
34-
export function registerChatExplicitContextProvider(id: string, provider: ChatExplicitContextProvider): Disposable;
35-
36-
/**
37-
* Register a chat resource context provider. Resource context is provided for a specific resource.
38-
* Make sure to pass a selector that matches the resource you want to provide context for.
39-
*
40-
* To ensure your extension is activated when chat context is requested, make sure to include the `onChatContextProvider:<id>` activation event in your `package.json`.
41-
*
42-
* @param selector Document selector to filter which resources the provider is called for.
43-
* @param id Unique identifier for the provider.
44-
* @param provider The chat resource context provider.
45-
*/
46-
export function registerChatResourceContextProvider(selector: DocumentSelector, id: string, provider: ChatResourceContextProvider): Disposable;
47-
48-
/**
49-
* Register a chat context provider.
50-
*
51-
* @deprecated Use {@link registerChatWorkspaceContextProvider}, {@link registerChatExplicitContextProvider}, or {@link registerChatResourceContextProvider} instead.
52-
*
5324
* @param selector Optional document selector to filter which resources the provider is called for. If omitted, the provider will only be called for explicit context requests.
5425
* @param id Unique identifier for the provider.
5526
* @param provider The chat context provider.
@@ -61,21 +32,12 @@ declare module 'vscode' {
6132
export interface ChatContextItem {
6233
/**
6334
* Icon for the context item.
64-
* - If `icon` is not defined, no icon is shown.
65-
* - If `icon` is defined and is a file or folder icon, the icon is derived from {@link resourceUri} if `resourceUri` is defined.
66-
* - Otherwise, `icon` is used.
6735
*/
68-
icon?: ThemeIcon;
36+
icon: ThemeIcon;
6937
/**
7038
* Human readable label for the context item.
71-
* If not set, the label is derived from {@link resourceUri}.
72-
*/
73-
label?: string;
74-
/**
75-
* A resource URI for the context item.
76-
* Used to derive the {@link label} and {@link icon} if they are not set.
7739
*/
78-
resourceUri?: Uri;
40+
label: string;
7941
/**
8042
* An optional description of the context item, e.g. to describe the item to the language model.
8143
*/
@@ -95,24 +57,23 @@ declare module 'vscode' {
9557
command?: Command;
9658
}
9759

98-
export interface ChatWorkspaceContextProvider<T extends ChatContextItem = ChatContextItem> {
60+
export interface ChatContextProvider<T extends ChatContextItem = ChatContextItem> {
9961

10062
/**
10163
* An optional event that should be fired when the workspace chat context has changed.
10264
*/
10365
onDidChangeWorkspaceChatContext?: Event<void>;
10466

10567
/**
68+
* TODO @API: should this be a separate provider interface?
69+
*
10670
* Provide a list of chat context items to be included as workspace context for all chat requests.
10771
* This should be used very sparingly to avoid providing useless context and to avoid using up the context window.
10872
* A good example use case is to provide information about which branch the user is working on in a source control context.
10973
*
11074
* @param token A cancellation token.
11175
*/
112-
provideChatContext(token: CancellationToken): ProviderResult<T[]>;
113-
}
114-
115-
export interface ChatExplicitContextProvider<T extends ChatContextItem = ChatContextItem> {
76+
provideWorkspaceChatContext?(token: CancellationToken): ProviderResult<T[]>;
11677

11778
/**
11879
* Provide a list of chat context items that a user can choose from. These context items are shown as options when the user explicitly attaches context.
@@ -121,18 +82,7 @@ declare module 'vscode' {
12182
*
12283
* @param token A cancellation token.
12384
*/
124-
provideChatContext(token: CancellationToken): ProviderResult<T[]>;
125-
126-
/**
127-
* If a chat context item is provided without a `value`, this method is called to resolve the `value` for the item.
128-
*
129-
* @param context The context item to resolve.
130-
* @param token A cancellation token.
131-
*/
132-
resolveChatContext(context: T, token: CancellationToken): ProviderResult<ChatContextItem>;
133-
}
134-
135-
export interface ChatResourceContextProvider<T extends ChatContextItem = ChatContextItem> {
85+
provideChatContextExplicit?(token: CancellationToken): ProviderResult<T[]>;
13686

13787
/**
13888
* Given a particular resource, provide a chat context item for it. This is used for implicit context (see the settings `chat.implicitContext.enabled` and `chat.implicitContext.suggestedContext`).
@@ -144,51 +94,15 @@ declare module 'vscode' {
14494
* @param options Options include the resource for which to provide context.
14595
* @param token A cancellation token.
14696
*/
147-
provideChatContext(options: { resource: Uri }, token: CancellationToken): ProviderResult<T | undefined>;
97+
provideChatContextForResource?(options: { resource: Uri }, token: CancellationToken): ProviderResult<T | undefined>;
14898

14999
/**
150-
* If a chat context item is provided without a `value`, this method is called to resolve the `value` for the item.
100+
* If a chat context item is provided without a `value`, from either of the `provide` methods, this method is called to resolve the `value` for the item.
151101
*
152102
* @param context The context item to resolve.
153103
* @param token A cancellation token.
154104
*/
155105
resolveChatContext(context: T, token: CancellationToken): ProviderResult<ChatContextItem>;
156106
}
157107

158-
/**
159-
* @deprecated Use {@link ChatWorkspaceContextProvider}, {@link ChatExplicitContextProvider}, or {@link ChatResourceContextProvider} instead.
160-
*/
161-
export interface ChatContextProvider<T extends ChatContextItem = ChatContextItem> {
162-
163-
/**
164-
* An optional event that should be fired when the workspace chat context has changed.
165-
* @deprecated Use {@link ChatWorkspaceContextProvider.onDidChangeWorkspaceChatContext} instead.
166-
*/
167-
onDidChangeWorkspaceChatContext?: Event<void>;
168-
169-
/**
170-
* Provide a list of chat context items to be included as workspace context for all chat requests.
171-
* @deprecated Use {@link ChatWorkspaceContextProvider.provideChatContext} instead.
172-
*/
173-
provideWorkspaceChatContext?(token: CancellationToken): ProviderResult<T[]>;
174-
175-
/**
176-
* Provide a list of chat context items that a user can choose from.
177-
* @deprecated Use {@link ChatExplicitContextProvider.provideChatContext} instead.
178-
*/
179-
provideChatContextExplicit?(token: CancellationToken): ProviderResult<T[]>;
180-
181-
/**
182-
* Given a particular resource, provide a chat context item for it.
183-
* @deprecated Use {@link ChatResourceContextProvider.provideChatContext} instead.
184-
*/
185-
provideChatContextForResource?(options: { resource: Uri }, token: CancellationToken): ProviderResult<T | undefined>;
186-
187-
/**
188-
* If a chat context item is provided without a `value`, this method is called to resolve the `value` for the item.
189-
* @deprecated Use the `resolveChatContext` method on the specific provider type instead.
190-
*/
191-
resolveChatContext?(context: T, token: CancellationToken): ProviderResult<ChatContextItem>;
192-
}
193-
194108
}

0 commit comments

Comments
 (0)