Sublime Forum

Reindent failed with preprocessor in Fortran

#1

Say I have a Fortran90 file that looks like this (see Figure 1)

Here I have multiple definition of a subroutine because I need different number and types of parameters depending on the case I will be running.

Now if I select all of them and reindent, this is what I get (see Figure 2)

It appears to me that only the second definition is recognized and selected to form a subroutine body along with the rest of the code.

This could lead to horrible indentation result like Figure3.

I think multiple definitions of a subroutine could be done using the interface feature in the latest Fortran but there are so many instances like this in our code that fixing them one by one costs too much time.

Is there anyway to help sublime treat the content in preprocessors equally in terms of indentation?

Sorry about the picture. I can only upload one as a new user.

Thanks!
Ben

0 Likes

#2

Hi,

Just to be clear, are you using the https://packagecontrol.io/packages/Fortran package for syntax highlighting?

I’ve written a post about indentation here:

maybe someone with more time than me could tell you specifically what to change to get the behavior you desire, but if you want to investigate it yourself in the meantime, hopefully the info from that post will help

0 Likes

#3

Hi kingkeith,

Yes I am using that package. Thanks for the link I will start from there.

Regards,
Ben

0 Likes