Ignore warning produced in VS code

Hi everyone,

I have somewhat recently found myself in charge of a somewhat large Fortran project. I do not have very much Fortran experience (but am learning as I go). The project was authored by someone who knew enough Fortran to get things working but not enough to know best practices. My goal right now is to remove a lot of the non-standard Fortran and set up some build pipelines in preparation for some larger structural changes (which I will probably ask questions about later).

However, the issue I am encountering now is in Visual Studio Code. I am seeing hundreds or warning messages of the ilk “Variable ‘<variable_name>’ masks variable in parent scope”. From what I can tell, most of these are apparently due to subroutine definitions in separate submodule files “masking” the subroutine definition in the module interface.

How can I either fix my code to not produce this warning or how can I suppress this warning?

Thanks!

These warnings stem from the language server fortls and not your compiler so it’s completely safe to ignore. You can disable the fortls diagnostics by setting the option --disable_diagnostics or clicking the GUI option in the VSCode settings.

As a side note, these warnings should probably be demoted to info messages instead.

Hope this helps.

Awesome thanks I know that I can ignore them. But because there are so many, I am missing warnings that I would like to address.

Is there a way to tell fortls to ignore this specfic warning but keep producing the others?

Thanks!

I’m not a VS code user, but I’m curious if using the ONLY clause in the USE statement might result in suppressing these warnings. Many programmers advocate using the ONLY clause routinely anyway.

Unfortunately not at this moment. I am looking for a better mechanism to control diagnostics, but it’s still early stages.