Closed stefabat closed 2 years ago
So this is caused by fortls (sometimes?) not respecting the module scopes. I think there a few more issues that are caused from this, especially when it comes to autocompletion.
The extend of this bug is generally related to visibility scopes and modules.
If a variable is not defined as private or public in the same line e.g. integer, private :: len
then there seems to be an issue distinguishing the public from private scopes.
If I remember correctly all modules are public
by default, so I think this should be relatively easy to fix.
Thanks, but lately I haven't been able to have fortls working in my vscode at all... I am bit confused on what should be installed: pip install fortran-language-server
or pip install fortls
? Reagrdless of which, I actually install it in a conda environment and then point vscode to the fortls
executable within the conda folder, but it doesn't work.
I think that might be a mistake on my end in the pre release of Modern Fortran. If you have turned on an option for disabling fortls it will skip registering the server all together see https://github.com/krvajal/vscode-fortran-support/issues/365 . I'll fix it over the weekend and in another prerelease
Ok, I had time to fix my setup and everything works. I can confirm that this fixes the issue and I don't see anymore the error.
Just for completeness and future reference, this is the current setup with which I managed to have it working:
I don't want to mess up my distribution python packages with pip, so what I have is a miniconda installation that I activate with the modulefiles system (like in HPC clusters). With conda active, I created a new environment where I installed fortls
with pip
. Then, in VSCode I only use the Modern Fortran extension in the pre-release version (hence no FORTRAN Intellisense and vscode-modern-fortran-formatter) and I explicitly set the path to the fortls
within the miniconda installation. Everything works!
Hi
I am using the fortran language server (FLS) in vscode, so I am not sure if it is a problem of the extension I am using, or the FLS itself. I suspect the second.
I have a private variable declared in a module with the same name as an intrinsic fortran keyword:
Somewhere else in the code, I declare
And vscode (through the FLS) is marking it as an error and saying 'object "len" not found in scope' and points me to the module above. Furthermore, if I start typing
the auto completion suggests me the variable
len
even though this is private and should not be seen. Indeed, trying to use the variablelen
anywhere else in the code runs into a compilation error withgfortran
.Any idea on what is going on?