fortran-lang / fortls

fortls - Fortran Language Server
https://fortls.fortran-lang.org/
MIT License
258 stars 41 forks source link

Doxygen style comments for modules and types #208

Closed plevold closed 1 year ago

plevold commented 2 years ago

Is your feature request related to a problem? Please describe. Fortls parses Doxygen style comments for subroutines and functions. This is a huge time saver as one does not have to "goto definition" to check what the procedure is supposed to do. It is also a good motivation to actually document the code we write since it increases the chances that somebody might read it. Double win! 👍 Example: image

As far as I can tell, fortls does not parse comments for modules and types. At least not in a way I was able to figure out. Neither of these comments seems to get picked up:

!> Maybe some module documentation could go here?
module some_mod
    !> Alternatively this might be the place for module documentation?
    implicit none

    private
    public foo
    public a_t

    !> Some documentation here?
    type :: a_t
        !> Or here?
    end type

contains

    !> This is a subroutine named foo
    subroutine foo(i)
        !> Some argument to foo
        integer, intent(in) :: i

        write(*,*) 'i = ', i
    end subroutine
end module

program main
    use some_mod, only: foo, a_t

    type(a_t) :: a

    call foo(123)
end program

Describe the solution you'd like I think it would be beneficial to parse and show Doxygen style comments for modules and types as well as procedures.

Describe alternatives you've considered One could add general documentation to each procedure as well, but this would end up with a lot of repetition.