fredrikekre/Runic.jl

Alignment

Closed this issue · 3 comments

Currently Runic destroys alignment because it is very stringent about spacing, for example

a  = 1
ab = 2

will be replaced with

a = 1
ab = 2

Doing this is of course a valid option (and what e.g. gofmt does).

The current rule is a single space around operators, but I wonder if relaxing it to at least a single space around operators would satisfy the "human need" to prettify things with alignment would be a good option. I think this would work in all situations where you typically align things.

What about comments? For example:

a  = 1.0 # important float
ab = 2   # fine as integer

Yea same would apply there -- at least one space before comment.

Perhaps #41 could be enough to solve this. I think that "useful" alignment is pretty rare but in cases where it is useful you can format it on your own instead. (The example in the OP is IMO a case of aligntment that isn't useful).

It seems very tricky to try to detect existing alignment in the code.