aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA-Walrus2023-06-21 14:52:42 +0000
committerGitHub2023-06-21 14:52:42 +0000
commiteb81cf3c013232fb1b01c51e9f3edba4cf39d977 (patch)
treecd7f76e1529b365f91c80c6fed452029b03fbfb7
parent18160a667be6ce30eb644dac2604d75fab9d63dc (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...
-rw-r--r--helix-core/src/syntax.rs2
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
&[]