mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-12 08:57:43 -05:00
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:
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user