hansec / fortran-language-server

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

Parsing external functions #177

Open thijssteel opened 3 years ago

thijssteel commented 3 years ago

A bit of a continuation of my previous issue.

When working with legacy code (and sometimes even recent codes written by old school hardliners), its quite common to simply have a file for each subroutine and not work with modules. For as far as i can tell these kinds of links are ignored by the language server because no use statements are present (sorry if i'm wrong about that, my python knowledge isn't that great.).

The default behaviour for most libraries is that the name of the file is also the name of the subroutine. Would it be possible to search the source path when a function is defined as external? Or perhaps we could keep a list of all the subroutines residing outside a module?

hansec commented 3 years ago

Thanks for the report. Although, I believe that the language server already handles this type of situation. Any functions/subroutines defined in files without modules should be automatically added to the "global" scope that is visible in every file, module, etc. Keep in mind all the source files must be visible to the language server either under the root path or via specifying specific directories. Do you have an example of a specific case where this is not happening?

thijssteel commented 3 years ago

Hmm, it seems I was a bit confused.

The hover functionality seems to work with both global scope and modules. So I was indeed wrong.

However, it seems the error wiggles when subroutine arguments do not match don't show up with the vscode plugin. When I use modules and the f90 extension, the modern fortran plugin in vscode does show error wiggles.

I'll investigate further.