fix: CSS files not being indexed (#7072)

CSS files were not being indexed because codeChunker expects code
structures (classes/functions) that don't exist in CSS. The chunker
would return zero chunks, preventing CSS files from being indexed.

This fix routes CSS, HTML, JSON and similar non-code files to
basicChunker instead of codeChunker, ensuring they are properly
indexed while maintaining intelligent chunking for actual code files.
This commit is contained in:
Suhas S 2025-08-24 23:41:18 +08:00
parent cd254a8af4
commit f67539882c

View file

@ -22,7 +22,22 @@ export async function* chunkDocumentWithoutId(
return;
}
const extension = getUriFileExtension(fileUri);
if (extension in supportedLanguages) {
// Files that should use basicChunker despite having tree-sitter support
// These files don't have code structure (classes/functions) that codeChunker expects
const NON_CODE_EXTENSIONS = [
"css",
"html",
"htm",
"json",
"toml",
"yaml",
"yml",
];
if (
extension in supportedLanguages &&
!NON_CODE_EXTENSIONS.includes(extension)
) {
try {
for await (const chunk of codeChunker(fileUri, contents, maxChunkSize)) {
yield chunk;