diff options
author | A-Walrus | 2023-06-21 14:52:42 +0000 |
---|---|---|
committer | GitHub | 2023-06-21 14:52:42 +0000 |
commit | eb81cf3c013232fb1b01c51e9f3edba4cf39d977 (patch) | |
tree | cd7f76e1529b365f91c80c6fed452029b03fbfb7 /helix-core | |
parent | 18160a667be6ce30eb644dac2604d75fab9d63dc (diff) |
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...
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/src/syntax.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 2a5bb974..f43b03ad 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -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 &[] |