hansec / fortran-language-server

Fortran Language Server for the Language Server Protocol
MIT License
294 stars 57 forks source link

Support for implicit types? #201

Open hckiang opened 3 years ago

hckiang commented 3 years ago

Hi, I am currently working on a project which uses a lot of old-style implicit variable types. For example:

module oumods
  use, intrinsic :: iso_c_binding
  implicit integer(c_int) (i-k), integer(c_int) (m,n), &
       & real(c_double) (a-h), real(c_double) (l), real(c_double) (o-z)
contains
  subroutine zI12(t,c,alpha,beta,r)
    complex(c_double_complex) c,r,    x,y,z
     z = c*t
     y = exp(z)
     x = (2.0_c_double * cosh((z - cmplx(0._c_double,3.14159265358979324_c_double, kind(1._c_double))) &
          & /2._c_double )) / (c / exp((z + cmplx(0._c_double,3.14159265358979324_c_double,kind(1._c_double)))/2._c_double))
     r = beta*r+alpha*((t*y - x)/c)
  end subroutine
end module

Currently the server seems unable to tell the type of variables t, alpha and beta.

I know ideally I should simply add explicit type declarations, but the existing code base is pretty large and complex so I'd rather not mess with it too much... It would be an very useful feature for the IDE to be able to display the types of them so the programmer doesn't need to "mentally calculate" the types.