Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indenting line labels #141

Open
blaylockbk opened this issue Oct 14, 2022 · 1 comment
Open

Indenting line labels #141

blaylockbk opened this issue Oct 14, 2022 · 1 comment
Labels
enhancement Enhancement to existing feature

Comments

@blaylockbk
Copy link
Contributor

I'm using this example from Milan Curcic's book
https://github.com/modern-fortran/stock-prices/blob/master/src/mod_io.f90

integer function num_records(filename)
  ! Return the number of records (lines) of a text file.
  character(len=*), intent(in) :: filename
  integer :: fileunit
  open(newunit=fileunit, file=filename)
  num_records = 0
  do
    read(unit=fileunit, fmt=*, end=1)
    num_records = num_records + 1
  end do
  1 continue
  close(unit=fileunit)
end function num_records

When fprettify formats this, the line label is pushed all the way left.

integer function num_records(filepath)
   ! Return the number of records (lines) of a text file.
   character(len=*), intent(in) :: filepath
   integer :: fileunit
   open (newunit=fileunit, file=filepath)
   num_records = 0
   do
      read (unit=fileunit, fmt=*, end=1)
      num_records = num_records + 1
   end do
1  continue                           ! <----- Note this line is dedented
   close (unit=fileunit)
end function num_records

I realize there are legacy reasons for putting the line label in the first column, but this interferes with code folding (VS Code). Is there any possibility of turning this off and letting the line label to be aligned with the rest of the content?

@blaylockbk blaylockbk changed the title Indenting for line labels Indenting line labels Oct 14, 2022
@vickysharma0812
Copy link

This behavior is correct. Although, I am not able to find an official documentation about the label specifier. From my experience, it is a good practice to put label at the first column of a line.

@pseewald pseewald added the enhancement Enhancement to existing feature label Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to existing feature
Projects
None yet
Development

No branches or pull requests

3 participants