Add support for `STRUCTURE` and `RECORD` blocks vendor extension
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?
- [X] I have searched the existing issues
Originally posted in: https://github.com/fortran-lang/vscode-fortran-support/issues/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.
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
Any news on this? Was it possible to implement?