fortran-lang / fprettify

auto-formatter for modern fortran source code
https://pypi.python.org/pypi/fprettify
Other
376 stars 78 forks source link

Whitespace before/after double colons #54

Closed tueda closed 5 years ago

tueda commented 5 years ago

Is it possible to adjust whitespace before/after double colons? Example:

$ cat test.f90
subroutine a()
   integer::b
   integer  ::  c
end subroutine

I would like to have

$ fprettify -s test.f90
subroutine a()
   integer :: b
   integer :: c
end subroutine

which can't be done with the current version (v0.3.4).

pseewald commented 5 years ago

For double colons, whitespace conventions are rather subjective (e.g. manual vertical alignment). Therefore I did not want to impose any strict rules for whitespaces around double colons.

tueda commented 5 years ago

Thank you for the prompt answer. Yes, I agree that this is subjective, but in future it would be very nice if one can select some convention, for example,

   integer :: x
   double precision :: y

or

   integer          :: x
   double precision :: y

by giving an option.

pseewald commented 5 years ago

Yes this would be a useful feature. I'm still hesitating because vertical alignment requires some heuristics based on adjacent lines, while the initial decision was that whitespace formatting should not be context aware (i.e. formatting is applied on each line independently).