Skip to content

Commit

Permalink
Fix tree sitter chunking (#7417)
Browse files Browse the repository at this point in the history
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...
  • Loading branch information
A-Walrus authored Jun 21, 2023
1 parent 18160a6 commit eb81cf3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ impl LanguageLayer {
&mut |byte, _| {
if byte <= source.len_bytes() {
let (chunk, start_byte, _, _) = source.chunk_at_byte(byte);
chunk[byte - start_byte..].as_bytes()
&chunk.as_bytes()[byte - start_byte..]
} else {
// out of range
&[]
Expand Down

0 comments on commit eb81cf3

Please sign in to comment.