@@ -493,18 +493,19 @@ impl Syntax {
493 let mut cursor = ts_parser.cursors.pop().unwrap_or_else(QueryCursor::new);
493 let mut cursor = ts_parser.cursors.pop().unwrap_or_else(QueryCursor::new);
494 // TODO: might need to set cursor range
494 // TODO: might need to set cursor range
496+ let source_slice = source.slice(..);
496 while let Some(layer_id) = queue.pop_front() {
498 while let Some(layer_id) = queue.pop_front() {
497 // Re-parse the tree.
499 // Re-parse the tree.
498 self.layers[layer_id].parse(ts_parser, source)?;
500 self.layers[layer_id].parse(ts_parser, source)?;
500− let source = source.slice(..);
501 let layer = &self.layers[layer_id];
502 let layer = &self.layers[layer_id];
503 // Process injections.
504 // Process injections.
504 let matches = cursor.matches(
505 let matches = cursor.matches(
505 &layer.config.injections_query,
506 &layer.config.injections_query,
506 layer.tree().root_node(),
507 layer.tree().root_node(),
507− RopeProvider(source),
508+ RopeProvider(source_slice),
509 let mut injections = Vec::new();
510 let mut injections = Vec::new();
510 for mat in matches {
511 for mat in matches {
@@ -512,12 +513,12 @@ impl Syntax {
512 &layer.config,
513 &layer.config,
513 &layer.config.injections_query,
514 &layer.config.injections_query,
515− source,
516+ source_slice,
518 // Explicitly remove this match so that none of its other captures will remain
519 // Explicitly remove this match so that none of its other captures will remain
519 // in the stream of captures.
520 // in the stream of captures.
520− mat.remove(); // TODO: is this still necessary?
521+ mat.remove();
522 // If a language is found with the given name, then add a new language layer
523 // If a language is found with the given name, then add a new language layer
523 // to the highlighted document.
524 // to the highlighted document.
@@ -542,7 +543,7 @@ impl Syntax {
542 let matches = cursor.matches(
543 let matches = cursor.matches(
543 combined_injections_query,
544 combined_injections_query,
544 layer.tree().root_node(),
545 layer.tree().root_node(),
545− RopeProvider(source),
546+ RopeProvider(source_slice),
547 for mat in matches {
548 for mat in matches {
548 let entry = &mut injections_by_pattern_index[mat.pattern_index];
549 let entry = &mut injections_by_pattern_index[mat.pattern_index];
@@ -550,7 +551,7 @@ impl Syntax {
550 &layer.config,
551 &layer.config,
551 combined_injections_query,
552 combined_injections_query,
553− source,
554+ source_slice,
555 if language_name.is_some() {
556 if language_name.is_some() {
556 entry.0 = language_name;
557 entry.0 = language_name;