fortran-plugin icon indicating copy to clipboard operation
fortran-plugin copied to clipboard

No syntax highlighting within preprocessor statements

Open richardfoltyn opened this issue 5 years ago • 5 comments

Hi,

I noticed that syntax highlighting within preprocessor statements no longer works. It worked just fine in earlier versions, but after opening a Fortran project for the first time after ~ 8 months I just saw it no longer does (hence I cannot say in which version exactly it stopped working).

Thanks!

Screenshot_20200225_075218

Edit: It seems that it works occasionally and I haven't found out yet when it breaks. I attached an actual file I am using in my project (rename to .F90), which renders in Clion as shown in below.

aggr_funcs.txt

image

Edit 2: I should also add that in the debugger within some code sections contained in preprocessor directives the variable window remains empty, even though I can still print the variables using gdb commands directly. Screenshot_20200225_083352

Edit 3: Trying out older versions of Clion from snap I see that things work as expected with Clion/Fortran plugin versions 2019.2.5/2019.2.1, but no longer work with the most recent versions 2019.3.4/2019.3.3.

richardfoltyn avatar Feb 25 '20 07:02 richardfoltyn

Just as a follow-up on this: The issue arises when one compiles TWO different executables from the same source code, but one has the pre-processor definition turned on and the other off. image

Then there does not seem to be a way to have the code highlighted/inactive depending on which executable one is debugging.

I've attached a minimal working example (rename main.txt to main.F90 to get around GH's file type restrictions). CMakeLists.txt

main.txt

It would be helpful to have the option to turn this feature off completely if it cannot be resolved in any reasonable way, otherwise I am stuck on CLion 2019.2 forever. Thanks!

richardfoltyn avatar Apr 22 '20 09:04 richardfoltyn

Hi. I was trying to improve preprocessor support, but I failed, because to do so I have to refactor CLion core to be able to integrate with their CMake support. This is quite difficult for me as I'm not member of CLion team. I understand that current verison is quite bad and I'll look for a possibility of option that will disable it.

satamas avatar Apr 22 '20 10:04 satamas

Ok, thanks! Such an option would be highly appreciated.

Your comment prompted me to investigate whether this works for a C project, and there Clion behaves as expected. The highlighting/inactive region changes depending on which target one selects in the drop-down box: image image

This is not the case for the Fortran project though. So maybe the Clion core has some mechanism in place to support something equivalent in Fortrran?

Minimal working example: CMakeLists.txt main.txt

richardfoltyn avatar Apr 22 '20 10:04 richardfoltyn

CLion itself knows nothing about Fortran preprocessor therefore I'm sure there is no such mechanism in current version. And there is absolutely no way to change this without updating CLion core. I'm saying it because I've tried.

satamas avatar Apr 22 '20 11:04 satamas

I see, that's unfortunate. Thanks for looking into it!

richardfoltyn avatar Apr 22 '20 11:04 richardfoltyn