From 6dd46bfe1c87a4ba4d3ae2feef1270a90ef5f67b Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 10 Jan 2024 13:06:57 -0500 Subject: [PATCH] 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. --- helix-core/src/syntax.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 0e8917191..6414f3ce9 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -1090,6 +1090,7 @@ impl Syntax { 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 @@ impl Syntax { depth, ranges, flags: LayerUpdateFlags::empty(), + parent: Some(layer_id), }; // Find an identical existing layer @@ -1525,6 +1527,7 @@ pub struct LanguageLayer { pub ranges: Vec, pub depth: u32, flags: LayerUpdateFlags, + parent: Option, } /// This PartialEq implementation only checks if that