fredrikekre / Runic.jl

A code formatter for Julia with rules set in stone.
MIT License
103 stars 3 forks source link

Drop trailing semicolons in block contexts #47

Closed fredrikekre closed 2 months ago

fredrikekre commented 2 months ago

This patch removes trailing semicolons in blocklike contexts (for, if, ...). Semicolons are left alone in top level contexts since they are sometimes used there for output suppression (e.g. Documenter examples or scripts that are copy-pasted/included in the REPL).

Semicolons before comments are replaced with a single space instead of removed so that if the comments are aligned before, they will be aligned after, for example

begin
    x = 1; # This is x
    y = 2  # This is y
end

will become

begin
    x = 1  # This is x
    y = 2  # This is y
end