Properly parse at-commands with narrow non-breaking spaces (#18677)

This commit is contained in:
Tommaso Sciortino
2026-02-09 16:51:24 -08:00
committed by GitHub
parent cc2798018b
commit eb94284256
4 changed files with 76 additions and 54 deletions

View File

@@ -319,6 +319,35 @@ describe('handleAtCommand', () => {
);
}, 10000);
it('should correctly handle file paths with narrow non-breaking space (NNBSP)', async () => {
const nnbsp = '\u202F';
const fileContent = 'NNBSP file content.';
const filePath = await createTestFile(
path.join(testRootDir, `my${nnbsp}file.txt`),
fileContent,
);
const relativePath = getRelativePath(filePath);
const query = `@${filePath}`;
const result = await handleAtCommand({
query,
config: mockConfig,
addItem: mockAddItem,
onDebugMessage: mockOnDebugMessage,
messageId: 129,
signal: abortController.signal,
});
expect(result.error).toBeUndefined();
expect(result.processedQuery).toEqual([
{ text: `@${relativePath}` },
{ text: '\n--- Content from referenced files ---' },
{ text: `\nContent from @${relativePath}:\n` },
{ text: fileContent },
{ text: '\n--- End of content ---' },
]);
});
it('should handle multiple @file references', async () => {
const content1 = 'Content file1';
const file1Path = await createTestFile(