Skip to content

Commit c13eb90

Browse files
authored
Load instructions on demand and don't add images (#288503)
* Load instructions on demand * Don't collect image references
1 parent 6334cf0 commit c13eb90

File tree

6 files changed

+6
-7
lines changed

6 files changed

+6
-7
lines changed

.github/instructions/chat.instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
applyTo: '**/chat/**'
32
description: Chat feature area coding guidelines
43
---
54

.github/instructions/interactive.instructions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
2-
applyTo: '**/interactive/**'
3-
description: Architecture documentation for VS Code interactive window component
2+
description: Architecture documentation for VS Code interactive window component. Use when working in folder
43
---
54

65
# Interactive Window

.github/instructions/learnings.instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
applyTo: **
32
description: This document describes how to deal with learnings that you make. (meta instruction)
43
---
54

.github/instructions/notebook.instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
applyTo: '**/notebook/**'
32
description: Architecture documentation for VS Code notebook and interactive window components
43
---
54

src/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ export class PromptBody {
346346
// Match markdown links: [text](link)
347347
const linkMatch = line.matchAll(/\[(.*?)\]\((.+?)\)/g);
348348
for (const match of linkMatch) {
349+
if (match.index > 0 && line[match.index - 1] === '!') {
350+
continue; // skip image links
351+
}
349352
const linkEndOffset = match.index + match[0].length - 1; // before the parenthesis
350353
const linkStartOffset = match.index + match[0].length - match[2].length - 1;
351354
const range = new Range(i + 1, linkStartOffset + 1, i + 1, linkEndOffset + 1);

src/vs/workbench/contrib/chat/test/common/promptSyntax/service/newPromptsParser.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ suite('NewPromptsParser', () => {
2222
/* 04 */`tools: ['tool1', 'tool2']`,
2323
/* 05 */'---',
2424
/* 06 */'This is an agent test.',
25-
/* 07 */'Here is a #tool:tool1 variable (and one with closing parenthesis after: #tool:tool-2) and a #file:./reference1.md as well as a [reference](./reference2.md).',
25+
/* 07 */'Here is a #tool:tool1 variable (and one with closing parenthesis after: #tool:tool-2) and a #file:./reference1.md as well as a [reference](./reference2.md) and an image ![image](./image.png).',
2626
].join('\n');
2727
const result = new PromptFileParser().parse(uri, content);
2828
assert.deepEqual(result.uri, uri);
@@ -42,7 +42,7 @@ suite('NewPromptsParser', () => {
4242
]);
4343
assert.deepEqual(result.body.range, { startLineNumber: 6, startColumn: 1, endLineNumber: 8, endColumn: 1 });
4444
assert.equal(result.body.offset, 75);
45-
assert.equal(result.body.getContent(), 'This is an agent test.\nHere is a #tool:tool1 variable (and one with closing parenthesis after: #tool:tool-2) and a #file:./reference1.md as well as a [reference](./reference2.md).');
45+
assert.equal(result.body.getContent(), 'This is an agent test.\nHere is a #tool:tool1 variable (and one with closing parenthesis after: #tool:tool-2) and a #file:./reference1.md as well as a [reference](./reference2.md) and an image ![image](./image.png).');
4646

4747
assert.deepEqual(result.body.fileReferences, [
4848
{ range: new Range(7, 99, 7, 114), content: './reference1.md', isMarkdownLink: false },

0 commit comments

Comments
 (0)