Skip to content

Commit

Permalink
feat: some more edge cases with anonymous nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
max397574 committed Jan 8, 2023
1 parent ac5effd commit e65cad1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ fn main() {
output.push_str(&" ".repeat(indent_level));
}

if cursor.node().kind() == "identifier"
&& check_parent("anonymous_node", cursor.node())
&& !check_parent("list", cursor.node().parent().unwrap())
{
output.push('\n');
output.push_str(&" ".repeat(indent_level));
}

if check_parent("parameters", cursor.node()) {
output.push(' ')
}
Expand All @@ -91,6 +99,12 @@ fn main() {
if cursor.node().kind() == "anonymous_node" && check_parent("list", cursor.node()) {
output.push_str(cursor.node().utf8_text(source_code.as_bytes()).unwrap());
}
if cursor.node().kind() == "identifier"
&& check_parent("anonymous_node", cursor.node())
&& !check_parent("list", cursor.node().parent().unwrap())
{
output.push_str(cursor.node().utf8_text(source_code.as_bytes()).unwrap());
}
if cursor.node().kind() == ":" {
output.push(' ');
}
Expand Down

0 comments on commit e65cad1

Please sign in to comment.