@@ -665,14 +665,10 @@ impl Syntax {
665 layer.depth == depth && // TODO: track parent id instead
665 layer.depth == depth && // TODO: track parent id instead
666 layer.config.language == config.language && layer.ranges == ranges
666 layer.config.language == config.language && layer.ranges == ranges
668− .map(|(id, _layer)| {
668+ .map(|(id, _layer)| id);
669− log::info!("match! {:?}", id);
673 // ...or insert a new one.
670 // ...or insert a new one.
674 let layer_id = layer.unwrap_or_else(|| {
671 let layer_id = layer.unwrap_or_else(|| {
675− log::info!("miss! {:?}", ranges);
676 self.layers.insert(LanguageLayer {
672 self.layers.insert(LanguageLayer {
677 tree: None,
673 tree: None,
@@ -714,7 +710,6 @@ impl Syntax {
715 .filter_map(|(_, layer)| {
711 .filter_map(|(_, layer)| {
716 // TODO: if range doesn't overlap layer range, skip it
712 // TODO: if range doesn't overlap layer range, skip it
717− // we can calculate intersection and use it later for set_byte_range
719 // Reuse a cursor from the pool if available.
714 // Reuse a cursor from the pool if available.
720 let mut cursor = PARSER.with(|ts_parser| {
715 let mut cursor = PARSER.with(|ts_parser| {
@@ -729,7 +724,6 @@ impl Syntax {
729 unsafe { mem::transmute::<_, &'static mut QueryCursor>(&mut cursor) };
724 unsafe { mem::transmute::<_, &'static mut QueryCursor>(&mut cursor) };
731 // if reusing cursors & no range this resets to whole range
726 // if reusing cursors & no range this resets to whole range
732− // TODO: handle intersect (range & layer.range)
733 cursor_ref.set_byte_range(range.clone().unwrap_or(0..usize::MAX));
727 cursor_ref.set_byte_range(range.clone().unwrap_or(0..usize::MAX));
735 let mut captures = cursor_ref
729 let mut captures = cursor_ref