Skip to content

Commit

Permalink
julefmt: improve use declaration formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Mar 24, 2024
1 parent 4c49bc2 commit f314a8b
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/format.jule
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,28 @@ impl Formatter {
if d.selected.len == 0 {
ret
}
self.write("::{\n")
let mut newline = false
let mut row = d.token.row
for _, s in d.selected {
self.write(" ")
if row != s.row {
newline = true
break
}
}
self.write("::{")
if newline {
self.write("\n")
}
for i, s in d.selected {
if newline {
self.write(" ")
}
self.write(s.kind)
self.write(",\n")
if newline {
self.write(",\n")
} else if i + 1 < d.selected.len {
self.write(", ")
}
}
self.write("}")
}
Expand Down

0 comments on commit f314a8b

Please sign in to comment.