on master help sign in
Resolve some outdated comments
4b0205fBlaž Hrastnik
helix-core/src/syntax.rs+1−37
@@ -470,13 +470,10 @@ impl Syntax {
470 })
470 })
471 };
471 };
472
472
473− // HAXX: for now, clear all layers except root so they get re-parsed
474− // self.layers.retain(|id, _| id == self.root);
475−
476 // Convert the changeset into tree sitter edits.
473 // Convert the changeset into tree sitter edits.
477 let edits = generate_edits(old_source, changeset);
474 let edits = generate_edits(old_source, changeset);
478
475
479− // TODO: use the edits to update all layers markers
476+ // Use the edits to update all layers markers
480 if !edits.is_empty() {
477 if !edits.is_empty() {
481 fn point_add(a: Point, b: Point) -> Point {
478 fn point_add(a: Point, b: Point) -> Point {
482 if b.row > 0 {
479 if b.row > 0 {
@@ -716,25 +713,6 @@ impl Syntax {
716 self.layers[self.root].tree()
713 self.layers[self.root].tree()
717 }
714 }
718
715
719− // root: Tree
720− // injections: Vec<(Tree, Range marker)>
721−
722− // handle updates that go over a part of the layer by truncating them to start/end appropriately
723−
724− // injections tracked by marker:
725− // if marker areas match it's fine and update
726− // if not found add new layer
727− // if length 0 then area got removed, clean up the layer
728− //
729− // layer update:
730− // if range.len = 0 then remove the layer
731− // calculate affected range and update injections
732− // injection update:
733− // look for existing injections
734− // if present, range = (first injection start, last injection end)
735−
736− // Highlighting
737−
738 /// Iterate over the highlighted regions for a given slice of source code.
716 /// Iterate over the highlighted regions for a given slice of source code.
739 pub fn highlight_iter<'a>(
717 pub fn highlight_iter<'a>(
740 &'a self,
718 &'a self,
@@ -813,8 +791,6 @@ impl Syntax {
813 result.sort_layers();
791 result.sort_layers();
814 result
792 result
815 }
793 }
816− // on_tokenize
817− // on_change_highlighting
818
794
819 // Commenting
795 // Commenting
820 // comment_strings_for_pos
796 // comment_strings_for_pos
@@ -826,12 +802,6 @@ impl Syntax {
826 // indent_level_for_line
802 // indent_level_for_line
827
803
828 // TODO: Folding
804 // TODO: Folding
829−
830− // Syntax APIs
831− // get_syntax_node_containing_range ->
832− // ...
833− // get_syntax_node_at_pos
834− // buffer_range_for_scope_at_pos
835}
805}
836
806
837#[derive(Debug)]
807#[derive(Debug)]
@@ -938,12 +908,6 @@ pub(crate) fn generate_edits(
938 let (start_byte, start_position) = point_at_pos(old_text, old_pos);
908 let (start_byte, start_position) = point_at_pos(old_text, old_pos);
939 let (old_end_byte, old_end_position) = point_at_pos(old_text, old_end);
909 let (old_end_byte, old_end_position) = point_at_pos(old_text, old_end);
940
910
941− // TODO: Position also needs to be byte based...
942− // let byte = char_to_byte(old_pos)
943− // let line = char_to_line(old_pos)
944− // let line_start_byte = line_to_byte()
945− // Position::new(line, line_start_byte - byte)
946−
947 // deletion
911 // deletion
948 edits.push(tree_sitter::InputEdit {
912 edits.push(tree_sitter::InputEdit {
949 start_byte, // old_pos to byte
913 start_byte, // old_pos to byte