Skip to content

Commit 8d6318a

Browse files
committed
add ChatAgentResponseItemMetadata to stream builder methods, gives place for future annotations
1 parent 6c22451 commit 8d6318a

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

src/vs/workbench/api/common/extHostChatAgents2.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,32 @@ class ChatAgentResponseStream {
7373
};
7474

7575
this._apiObject = {
76-
markdown(value) {
76+
markdown(value, meta) {
7777
throwIfDone(this.markdown);
7878
_report({
7979
kind: 'markdownContent',
8080
content: typeConvert.MarkdownString.from(value)
8181
});
8282
return this;
8383
},
84-
text(value) {
84+
text(value, meta) {
8585
throwIfDone(this.text);
86-
this.markdown(new MarkdownString().appendText(value));
86+
this.markdown(new MarkdownString().appendText(value), meta);
8787
return this;
8888
},
89-
files(value) {
89+
files(value, meta) {
9090
throwIfDone(this.files);
9191
_report({
9292
kind: 'treeData',
9393
treeData: value
9494
});
9595
return this;
9696
},
97-
anchor(value) {
97+
anchor(value, meta) {
9898
throwIfDone(this.anchor);
9999
_report({
100100
kind: 'inlineReference',
101+
name: meta?.title,
101102
inlineReference: !URI.isUri(value) ? typeConvert.Location.from(<vscode.Location>value) : value
102103
});
103104
return this;
@@ -118,10 +119,6 @@ class ChatAgentResponseStream {
118119
});
119120
return this;
120121
},
121-
// annotation(value) {
122-
// _report(value);
123-
// return this;
124-
// },
125122
report(progress) {
126123
throwIfDone(this.report);
127124
if ('placeholder' in progress && 'resolvedContent' in progress) {

src/vscode-dts/vscode.proposed.chatAgents2.d.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -274,25 +274,32 @@ declare module 'vscode' {
274274
variables: Record<string, ChatVariableValue[]>;
275275
}
276276

277+
export interface ChatAgentResponseItemMetadata {
278+
title: string;
279+
// annotations: any[]; // future OffsetbasedAnnotation and Annotation
280+
}
281+
277282
export interface ChatAgentResponseStream {
278283

279284
// RENDERED
280-
markdown(value: string | MarkdownString): ChatAgentResponseStream;
281-
text(value: string): ChatAgentResponseStream;
282-
files(value: ChatAgentFileTreeData): ChatAgentResponseStream;
283-
// TODO@jrieken is this sugar for markdown syntax? should we have more like codeblock, bulletlist etc?
284-
anchor(value: Uri | Location, attributes?: { title?: string }): ChatAgentResponseStream;
285+
286+
text(value: string, meta?: ChatAgentResponseItemMetadata): ChatAgentResponseStream;
287+
288+
markdown(value: string | MarkdownString, meta?: ChatAgentResponseItemMetadata): ChatAgentResponseStream;
289+
290+
files(value: ChatAgentFileTreeData, meta?: ChatAgentResponseItemMetadata): ChatAgentResponseStream;
291+
292+
anchor(value: Uri | Location, meta?: ChatAgentResponseItemMetadata): ChatAgentResponseStream;
285293

286294
// META
295+
287296
// TODO@API this influences the rendering, it inserts new lines which is likely a bug
288297
progress(value: string): ChatAgentResponseStream;
289298

290299
// TODO@API support non-file uris, like http://example.com
300+
// TODO@API support mapped edits
291301
reference(value: Uri | Location): ChatAgentResponseStream;
292302

293-
// TODO@API define support annotations
294-
// annotation(value: string | MarkdownString | ChatXYZAnnotation, references?: string): ChatAgentResponseStream;
295-
296303
/**
297304
* @deprecated use above methods instread
298305
*/

0 commit comments

Comments
 (0)