Skip to content

Commit

Permalink
julefmt: minor improvement for comment handling of match-case statements
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Oct 29, 2024
1 parent a615de3 commit a338112
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/format.jule
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,18 @@ impl scopeFormatter {
self.formatStmts(mc.Default.Scope, false)
self.fmt.doneIndent()
}

// Write remaining comments with indentation if
// any case exist.
caseExist := len(mc.Cases) > 0 || mc.Default != nil
if caseExist {
self.fmt.addIndent()
}
self.fmt.writeCommentsExcept(mc.End.Row)
if caseExist {
self.fmt.doneIndent()
}

self.fmt.buf.Write(self.fmt.indent)!
self.fmt.row = mc.End.Row
self.write("}")
Expand Down

0 comments on commit a338112

Please sign in to comment.