Skip to content

Commit 7b878f5

Browse files
authored
Drop invalid inline reference values (#230737)
that came from the Copilot Chat version compatible with 1.95 Fix https://github.com/microsoft/vscode-copilot-release#1755
1 parent 185c2f2 commit 7b878f5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/vs/workbench/contrib/chat/common/chatModel.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,15 @@ export class Response extends Disposable implements IResponse {
235235

236236
constructor(value: IMarkdownString | ReadonlyArray<IMarkdownString | IChatResponseProgressFileTreeData | IChatContentInlineReference | IChatAgentMarkdownContentWithVulnerability | IChatResponseCodeblockUriPart>) {
237237
super();
238-
this._responseParts = asArray(value).map((v) => (isMarkdownString(v) ?
238+
const valueArr = asArray(value).filter(v => {
239+
if ('kind' in v && v.kind === 'inlineReference' && !Object.keys(v.inlineReference).length) {
240+
return false;
241+
}
242+
243+
return true;
244+
});
245+
246+
this._responseParts = valueArr.map((v) => (isMarkdownString(v) ?
239247
{ content: v, kind: 'markdownContent' } satisfies IChatMarkdownContent :
240248
'kind' in v ? v : { kind: 'treeData', treeData: v }));
241249

@@ -256,6 +264,10 @@ export class Response extends Disposable implements IResponse {
256264
}
257265

258266
updateContent(progress: IChatProgressResponseContent | IChatTextEdit | IChatTask, quiet?: boolean): void {
267+
if (progress.kind === 'inlineReference' && !Object.keys(progress.inlineReference).length) {
268+
return;
269+
}
270+
259271
if (progress.kind === 'markdownContent') {
260272
const responsePartLength = this._responseParts.length - 1;
261273
const lastResponsePart = this._responseParts[responsePartLength];

0 commit comments

Comments
 (0)