hansec / fortran-language-server

Fortran Language Server for the Language Server Protocol
MIT License
295 stars 57 forks source link

Object not found in scope #164

Closed lauvergn closed 3 years ago

lauvergn commented 4 years ago

In starting to try new fortran ide's (atom and VScode) and I've found almost the same issue for both. Since both ide's use fortranls, I'm guessing it is the right place to report the issue. For a large fortran code with several directories of source files and with atom, I've got several messages ("Object ... not found in scope"). See the pdf screen capture. ObjectNotFoundInScope.pdf

In the code, the "missing" modules are present. The code compiles and runs without trouble.

Any idea to solve this issue?

Thanks

hansec commented 3 years ago

Thanks for the report and sorry for the delay. This is a code diagnostic error that indicates that fortls cannot locate a class/type that is being used, which may indicate an error. In order to be visible to fortls, the modules containing the class/type must be inside the "project" folders (directory tree) in the current VSCode or atom window.

If this is the case and you are still seeing the error there may be an issue with parsing your code. Can you provide a short snippet that reproduces the issue or if your code is publicly accessible I'd be happy to take a look at that too.

lauvergn commented 3 years ago

The modules which include the types are in directories within the fortran project.

It will be difficult to give you a short snippet, because the code is very large. However, it is available from github: https://github.com/lauvergn/ElVibRot-TnumTana

The errors are still present with atom and it appends when the "Source_TnumTana_Coord/sub_module_Tnum.f90" file is opened in atom (NotFoundInScope.pdf).

Thanks

hansec commented 3 years ago

Thanks again for the report, I have identified the issue and implemented a fix that will be included in the next patch release. If you have the chance please checkout the fix in master and let me know if the issue persists or if you run into additional problems.

lauvergn commented 3 years ago

I've upgraded the fortran-language-server with pip (now I'm using the 1.12.0). However, in atom, the errors remain present even after restarting atom. I need to do something else ?