syntax: Track parent LanguageLayer IDs

This commit adds a `parent` field to the `LanguageLayer`. This
information is conveniently already available when we parse injections.
This will be used in the child commit to create a type that can
traverse injection layers using this information.
This commit is contained in:
Michael Davis 2024-01-10 13:06:57 -05:00 committed by Blaž Hrastnik
parent d5c2973cd1
commit 6dd46bfe1c

View File

@ -1090,6 +1090,7 @@ pub fn new(
start_point: Point::new(0, 0),
end_point: Point::new(usize::MAX, usize::MAX),
}],
parent: None,
};
// track scope_descriptor: a Vec of scopes for item in tree
@ -1360,6 +1361,7 @@ fn point_sub(a: Point, b: Point) -> Point {
depth,
ranges,
flags: LayerUpdateFlags::empty(),
parent: Some(layer_id),
};
// Find an identical existing layer
@ -1525,6 +1527,7 @@ pub struct LanguageLayer {
pub ranges: Vec<Range>,
pub depth: u32,
flags: LayerUpdateFlags,
parent: Option<LayerId>,
}
/// This PartialEq implementation only checks if that