Strip _vscodecontentref_ links from chat response markdown (#3823)

* Initial plan

* Strip _vscodecontentref_ links in unlikify pass of linkifier

Co-authored-by: vijayupadya <41652029+vijayupadya@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vijayupadya <41652029+vijayupadya@users.noreply.github.com>
This commit is contained in:
Copilot
2026-02-18 23:01:57 +00:00
committed by GitHub
parent fbf31b50cc
commit c85ce9619c
2 changed files with 18 additions and 0 deletions

View File

@@ -264,6 +264,11 @@ export class Linkifier implements ILinkifier {
return matched;
}
// Strip fake content reference links generated by models
if (path.includes('_vscodecontentref_')) {
return text;
}
return /^\w+:/.test(path) ? matched : text;
});
}

View File

@@ -311,6 +311,19 @@ suite('Stateful Linkifier', () => {
]);
});
test(`Should de-linkify _vscodecontentref_ links`, async () => {
const linkifier = createTestLinkifierService().createLinkifier(emptyContext);
const parts: string[] = [
'npx tsx [index.ts](http://_vscodecontentref_/1) eval [primer.eval.json](http://_vscodecontentref_/2) --repo .',
];
const result = await runLinkifier(linkifier, parts);
assertPartsEqual(result, [
'npx tsx index.ts eval primer.eval.json --repo .'
]);
});
test(`Should not unlinkify text inside of code blocks`, async () => {
const linkifier = createTestLinkifierService().createLinkifier(emptyContext);