Skip to content

Commit eb81cf3

Browse files
authored
Fix tree sitter chunking (#7417)
Call as bytes before slicing, that way you can take bytes that aren't aligned to chars. Should technically also be slightly faster since you don't have to check alignment...
1 parent 18160a6 commit eb81cf3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

helix-core/src/syntax.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,7 @@ impl LanguageLayer {
14021402
&mut |byte, _| {
14031403
if byte <= source.len_bytes() {
14041404
let (chunk, start_byte, _, _) = source.chunk_at_byte(byte);
1405-
chunk[byte - start_byte..].as_bytes()
1405+
&chunk.as_bytes()[byte - start_byte..]
14061406
} else {
14071407
// out of range
14081408
&[]

0 commit comments

Comments
 (0)