Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for STRUCTURE and RECORD blocks vendor extension #171

Open
1 task done
sdsnatcher opened this issue Jul 12, 2022 · 3 comments
Open
1 task done

Add support for STRUCTURE and RECORD blocks vendor extension #171

sdsnatcher opened this issue Jul 12, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@sdsnatcher
Copy link

Description

fortls seems to be not recognizing structures. We have many of them on a huge legacy code. Here are some an examples:

      Structure /DbTag/
      Integer*4      Name(SZ_TAG)
      Integer*4      Id
      Integer*4      Fnt(SZ_FNT)
      End Structure

      Structure /DbValue/
      Real*4         Value
      Integer*4      Status
      Integer*4      TimeStamp  ! included
      Integer*4      Action
      End Structure

      Structure /MsgValue/
      Integer*4      Mensagem(SZ_MSG)
      Integer*4      Status
      End Structure

And the the following problems are reported by fortls on VSCode:

Unexpected end statement: No open scopes
Unexpected end statement: No open scopes
Variable "Status" declared twice in scope
Unexpected end statement: No open scopes


The same code compiles without issues on gfortran 11.2.0, with the -fdec command line switch.

Expected Behaviour

Should be able to recognize structures. An option to enable -fdec support would be excellent.

Version of Modern Fortran

3.2.0

Version of Visual Studio Code

1.69.0

Platform and Architecture

Windows-10

Additional Information

I have the following linter arguments configured on settings.json:

    "fortran.linter.extraArgs": [
        "-fdec",
        "-finit-local-zero",
        "-fno-underscoring",
        "-Wuninitialized"
      ],

Is there an existing issue for this?

  • I have searched the existing issues
@sdsnatcher sdsnatcher added the bug Something isn't working label Jul 12, 2022
@gnikit gnikit added enhancement New feature or request and removed bug Something isn't working labels Jul 12, 2022
@gnikit gnikit changed the title [BUG] Language Server doesn't recognize structures Language Server doesn't recognize structures Jul 12, 2022
@gnikit
Copy link
Member

gnikit commented Jul 12, 2022

Originally posted in: fortran-lang/vscode-fortran-support#571

@sdsnatcher As I mentioned in our last conversation I don't see this being implemented unless:

  • it's not intrusive to the rest of the codebase
  • and it's done by a user

Feel free to open a PR and have a try yourself. Here are the instructions for you to get started with contributing to fortls https://github.com/gnikit/fortls/blob/master/CONTRIBUTING.md

You might want to ask in our Discourse group if there are many users affected by this, which in that case I might allocate some time and implement a fix.

@gnikit gnikit changed the title Language Server doesn't recognize structures Add support for STRUCTURE and RECORD blocks vendor extension Jul 12, 2022
@gnikit
Copy link
Member

gnikit commented Nov 18, 2022

I will have some time to look into this today. I should be able to add structure as an additional scope. I am really not familiar with the STRUCTURE, RECORD syntax, from what I understand is user defined types before TYPE

@sdsnatcher
Copy link
Author

Any news on this? Was it possible to implement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants