Skip to content

Commit

Permalink
Drop invalid inline reference values (#230737)
Browse files Browse the repository at this point in the history
that came from the Copilot Chat version compatible with 1.95
Fix https://github.com/microsoft/vscode-copilot-release#1755
  • Loading branch information
roblourens authored Oct 8, 2024
1 parent 185c2f2 commit 7b878f5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/vs/workbench/contrib/chat/common/chatModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,15 @@ export class Response extends Disposable implements IResponse {

constructor(value: IMarkdownString | ReadonlyArray<IMarkdownString | IChatResponseProgressFileTreeData | IChatContentInlineReference | IChatAgentMarkdownContentWithVulnerability | IChatResponseCodeblockUriPart>) {
super();
this._responseParts = asArray(value).map((v) => (isMarkdownString(v) ?
const valueArr = asArray(value).filter(v => {
if ('kind' in v && v.kind === 'inlineReference' && !Object.keys(v.inlineReference).length) {
return false;
}

return true;
});

this._responseParts = valueArr.map((v) => (isMarkdownString(v) ?
{ content: v, kind: 'markdownContent' } satisfies IChatMarkdownContent :
'kind' in v ? v : { kind: 'treeData', treeData: v }));

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

updateContent(progress: IChatProgressResponseContent | IChatTextEdit | IChatTask, quiet?: boolean): void {
if (progress.kind === 'inlineReference' && !Object.keys(progress.inlineReference).length) {
return;
}

if (progress.kind === 'markdownContent') {
const responsePartLength = this._responseParts.length - 1;
const lastResponsePart = this._responseParts[responsePartLength];
Expand Down

0 comments on commit 7b878f5

Please sign in to comment.