Skip to content

bug(syntax): fypp highlighting breaks with derived types #715

@jphaupt

Description

@jphaupt

Is there an existing issue for this?

  • I have searched the existing issues

Description

I noticed fypp support has recently been added, thanks a lot!! I understand it's still new, but I've noticed a little bug:

  • First (I suspect this is something to do with my configuration?) if my file extension is .fpp then it looks like nothing is recognised, there are red squiggles everywhere (I have it configured for Fortran). If I rename it to have .fypp extension and don't change anything else, suddenly it's fine.
  • If I have a derived type that uses the preprocessor, then any code that comes after that derived type loses all syntax highlighting.

In the attached screenshot, all the highlighting goes back the way I expect it to be if I:

  • rename to .fypp
  • remove the derived type

Screenshots

image

Code Example

program highlighting_eg
    use iso_fortran_env, only: sp => real32, dp => real64
    implicit none
    #:for dtype in ['real', 'complex']
    #:for prec in ['sp', 'dp']
    ${dtype}$(${prec}$) :: a_${dtype}$_${prec}$
    #:endfor
    #:endfor

    #:for dtype in ['real', 'complex']
    type literally_anything_${dtype}$_t
    endtype literally_anything_${dtype}$_t
    #:endfor

    contains

    subroutine print(arg)
        real, intent(in) :: arg
        print*, arg
    end subroutine print
end program highlighting_eg

Fortran Version (Free/Fixed Form)

Free Form e.g. F90+

Version of Modern Fortran

v3.2.0

Version of Visual Studio Code

v1.72.2

Platform and Architecture

Linux (OpenSUSE)

Additional Information

I noticed my other issue got sent into discussion. Should this also be there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions