Ignore unnamed nodes
This commit is contained in:
parent
fc7288a27f
commit
1314dce07d
|
@ -52,6 +52,9 @@ impl Config {
|
||||||
impl FiletypeConfig {
|
impl FiletypeConfig {
|
||||||
pub fn is_node_visible(&self, node: Node) -> bool {
|
pub fn is_node_visible(&self, node: Node) -> bool {
|
||||||
let kind = node.kind();
|
let kind = node.kind();
|
||||||
|
if !node.is_named() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
match &self.whitelist {
|
match &self.whitelist {
|
||||||
Some(whitelist) => whitelist.iter().any(|x| x == kind),
|
Some(whitelist) => whitelist.iter().any(|x| x == kind),
|
||||||
None => match &self.blacklist {
|
None => match &self.blacklist {
|
||||||
|
|
|
@ -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) {
|
for child in parent.children(&mut cursor) {
|
||||||
if child.range().start_byte <= range.start_byte
|
if child.range().start_byte <= range.start_byte
|
||||||
&& range.end_byte <= child.range().end_byte
|
&& range.end_byte <= child.range().end_byte
|
||||||
|
&& child.is_named()
|
||||||
{
|
{
|
||||||
node = child;
|
node = child;
|
||||||
continue 'outer;
|
continue 'outer;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user