fortran-language-server
fortran-language-server copied to clipboard
allow dotted syntax for derived type member variables
I realise this is a non-standard extension, however, it's quite wide-spread and I prefer it to the percent symbol, simply because of much better readability.
type mytype
integer :: member1
integer :: member2
end type
type(mytype) :: mytypeInstance
mytypeInstance%member1 ! go to definition works fine here
mytypeInstance.member2 ! this is not recognised properly
It should at least be an option for people who have grown accustomed to this syntax.
I would certainly consider supporting this feature (optionally), but I have never seen it used personally. Do you know what compilers support it? I couldn't find any documentation on it with a quick internet search (Intel/GCC).
I use it with Intel, not sure about GCC. Intel won't even issue any warnings unless you use the -stand compiler flag as per this discussion: https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/539584
I hesitate to add this feature since not only is it a non-standard extension but it is not officially documented either. I agree that the dotted syntax is cleaner and it does appear to be used in some fields. However, I don't think the language server should include support for any extensions that aren't at least a documented part of one of the main compilers (Intel, GCC, Cray, etc.).
I will leave this issue open for discussion. If a lot of people find this useful I am not strongly opposed to adding it.
I understand.
I will probably just fork the server and add this for my personal use meanwhile, as I don't want to change all my code.
It works under ifort
without any additional options.
In gfortran
one needs to enable "DEC compatibility mode". From the documentation:
-fdec-structure
Enable DEC STRUCTURE and RECORD as well as UNION, MAP, and dot (’.’) as a member separator (in addition to ’%’). This is provided for compatibility only; Fortran 90 derived types should be used instead where possible.