Skip to content

bug: #include seems to confuse modern_fortran and leads to false 'error' messages #1161

Open
@tommy-engels

Description

@tommy-engels

Is there an existing issue for this?

  • I have searched the existing issues

I have tried the Pre-Release of the extension.

  • I have replicated the Issue in the latest Pre-Release

Description

I have modules that look like this:

module fantastic_module
    use other_module

    implicit none

contains

#include "a_routine.f90"

end module

and in other_module, a constant rkis defined and to be used as real kind parameter.

In vscode, if I now edit a_routine.f90, this constant rk and anything else that is imported from other_module is not recognized and reported as error in VS code. Strangely, with the latest version, it now seems to suggest "Possible objects" when hovering with the cursor over the false "error", but it still reports it as errors.

I realize that there is a difference between #include and include("file"), but I need to use the former for other reasons. As this is correct FORTRAN syntax, I don't quite understand why modern_fortran extension has trouble with it.

It is possible that this is a matter of configuration (and the source of the error is on my side of the screen), but frankly even after many attempts I cannot figure out what I need to do. Any help/pointer would be highly appreciated.

Screenshots

Image

Expected Behaviour

It should correctly parse the code and not report thousands of false errors.

Version of Modern Fortran

v3.2.0

Version of Visual Studio Code

1.95.3

Platform and Architecture

linux

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions