arnetheduck / nph

An opinionated code formatter for Nim
Other
77 stars 12 forks source link

Spaces around `..` and `..<` #31

Closed arnetheduck closed 5 months ago

arnetheduck commented 5 months ago

Although NEP1 suggests not having spaces around these infix operators, this creates an exception to the normal infix spacing rules.

In spite of this recommendation, lots of code out there maintains spaces around the operators which makes decision based on "existing practice" hard.

Adding to the complexity is in order to not break the AST, the code must take care to remove the spaces only in cases where the infix is not followed by another operator - this means that we sometimes will put spaces around these infixes and sometimes not, again leading to irregularity.

Since there's no consensus in existing code, the rule is irregular and causes implementation complexity, this PR removes the exception and formats .. and ..< with spaces.