Skip to content

bug(syntax): Comment in line continuation with apostrophe breaks highlighting #923

Open
@albertziegenhagel

Description

@albertziegenhagel

Is there an existing issue for this?

  • I have searched the existing issues

Description

In fixed-form Fortran, if I have a function call that spreads over multiple lines and somewhere in the middle of those lines there is a comment line (starting with a c in the first column) that includes an apostrophe (') the syntax highlighting is completely messed up after the apostrophe.

It seems that the comment line is not recognized correctly and then the apostrophe starts a string literal that is never matched. If I use an exclamation mark (!) instead of the c to start the comment line, the comment seems to get recognized correctly.

Screenshots

Incorrect:
image

Expected:
image

Code Example

      call foo(a,
     & b,
c I don't like this comment
     & d)

Minimal, compiling program:

      program hello
        print*, sign(1,
c I don't like this comment
     &  -5)
      end program hello

Fortran Version (Free/Fixed Form)

Fixed Form e.g. F77

Version of Modern Fortran

v3.4.2023053001

Version of Visual Studio Code

1.79.2

Platform and Architecture

Windows

Additional Information

No response

Edit: added a minimal example that is a valid, compiling program (tested with gfortran and ifort)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions