diff --git a/src/config.rs b/src/config.rs index 357a3ae..1ef53a2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -52,6 +52,9 @@ impl Config { impl FiletypeConfig { pub fn is_node_visible(&self, node: Node) -> bool { let kind = node.kind(); + if !node.is_named() { + return false; + } match &self.whitelist { Some(whitelist) => whitelist.iter().any(|x| x == kind), None => match &self.blacklist { diff --git a/src/tree.rs b/src/tree.rs index 92a3e2d..e7ffbc7 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -12,6 +12,7 @@ pub fn shrink_to_range<'a>(root_node: Node<'a>, range: &Range) -> Node<'a> { for child in parent.children(&mut cursor) { if child.range().start_byte <= range.start_byte && range.end_byte <= child.range().end_byte + && child.is_named() { node = child; continue 'outer;