diff --git a/crates/tabby-index/src/code/mod.rs b/crates/tabby-index/src/code/mod.rs index 6c64b1501c01..0db9de468735 100644 --- a/crates/tabby-index/src/code/mod.rs +++ b/crates/tabby-index/src/code/mod.rs @@ -108,7 +108,9 @@ impl IndexAttributeBuilder for CodeBuilder { code::fields::CHUNK_BODY: body, }); - if text.len() == body.len() { + // When text length is not equal to body length, it means this chunk is not the entire + // content of the file, thus we need to record the start line. + if text.len() != body.len() { attributes[code::fields::CHUNK_START_LINE] = start_line.into(); } let embedding = embedding.clone();