Skip to content

Fixed format docstrings are not parsed correctly #534

Description

@erentar

Docstrings in fixed format code should ignore the whitespace at the beginning which is reserved for comment, label, and line continuation markers.

To Reproduce

      SUBROUTINE MYFUNC(PARAM1)
      !> THIS IS AN EXAMPLE FUNCTION TO DEMONSTRATE
      !! THE BROKEN PARSING OF
      !! DOCSTRINGS FOR FIXED FORMAT CODE

      REAL, INTENT(IN) :: PARAM1
      !> THE SAME PROBLEM OCCURS
      !! FOR DOCSTRINGS FOR PARAMETERS

      END SUBROUTINE MYFUNC
Image

the problem does not occur if I align the comment markers at the start

      SUBROUTINE MYFUNC(PARAM1)
      !> THIS IS AN EXAMPLE FUNCTION TO DEMONSTRATE
!!       THE BROKEN PARSING OF
!!       DOCSTRINGS FOR FIXED FORMAT CODE

      REAL, INTENT(IN) :: PARAM1
      !> THE SAME PROBLEM OCCURS
!!       FOR DOCSTRINGS FOR PARAMETERS

      END SUBROUTINE MYFUNC
Image

Expected behavior
ignore the 6 spaces at the start

Setup information

  • Python Version 3.14.6
  • fortls Version 3.2.2
  • VSCode
  • Modern Fortran v4.0.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions