I’m pretty new to Fortran, so pardon if these questions are basic. i’ve installed fpm, Modern Fortran extension to VSCode and fortls, created a new project with fpm new. I’ve added stdlib as one of my dependencies on the fpm.toml file and ran fpm build. This is the end result:
So far so good, but my Problems tab is showing 2k+ issues, all of them on the dependencies. Is there any way of removing the dependencies from the error checking, while also keeping the libraries visible from VSCode to avoid the “Cannot open module foo.mod” message?
I imagined that the option would be this “Exclude Directories” thing, but I can’t manage to make it work. I’ve added all combinations of glob patterns trying to exclude the build directory, but no luck.
Additionally, I can’t interact with fortls through the command line. If I try, I get an unresponsive command prompt.
Can you post a few of these issues. They can be originating from either VSCode’s linter or fortls. My bet is the former. To appease the linter, after you have built with fpm, using something like this would probably work
Please attach your full VSCode and fortls settings along with the respected versions, so we are on the same page.
fortls is a server to the code editor, users are not meant to interact with it directly. For debugging and developers we have a set of options that we use Configuration options - fortls. I would also suggest having a read of the whole Configuration options page not just the debug section, and letting us know what is not clear for novices such as yourself so that we can improve it.
The diagnostics errors are from fortls. Here is a config that should work
// If you have a lot of dependencies you might want to fine-tune
// your REGEX so that the linter does not seek .mod and .smod files
// in so many directories
"fortran.linter.includePaths": [
"${workspaceFolder}/build/**",
"${workspaceFolder}/src/**",
],
// Previous comment applies here as well
"fortran.fortls.directories": [
"./src/**",
"./build/dependencies/**"
],
All the other fortran settings are redundant or incorrect.
I’ve added the config that you’ve suggested and removed all other configs, but the same behavior continues, the dependencies folder is included in the error checking.
every time I restart VSCode and open my project folder, it reads the full contents of the dependencies folder like this:
This is a separate issue from the ones mentioned. The pre-release has a feature enabled that will attempt to run all your sources through the linter. Disable it