Hello,
I have VS Code and Modern Fortran with fortls set up, on Windows.
I have a main source dir with some Fortran .f files, and a few subfolders (say lib
) with some Fortran files as well, both .f and .inc.
Say a.f
is in the main source dir.
Say b.f
and c.inc
are in the lib
subdir.
My issue is with the linting process in the editor only, I have no issue with compilation. (Note that in all the following cases, everything compiles fine on my side with a good makefile. This is really only a problem in the linting process)
An include 'c.inc'
statement in b.f
: everything is fine, fortls is fine, the linter raises no error.
(An include 'lib/c.inc'
statement in b.f
: everything is also fine).
An include 'c.inc'
statement in a.f
, then the linter raises an error, stating Cannot open included file 'c.inc'
. <= this is the one I would like to find out how to make the linter work with
An include 'lib/c.inc'
statement in a.f
: everything is fine, fortls is fine, the linter raises no error.
I am unsure on how to make fortls correctly find c.inc
when it is in a project subdirectory as the .f with include statement (and have all / any other such statement simply work). What is especially strange to me is that both include 'c.inc'
and include 'lib/c.inc'
are fine when stated from b.f
inside lib
.
Here are what I believe might be the relevant Modern Fortran / fortls options I have :
"fortran.linter.extraArgs": [
"-Wunused-variable",
"-Wunused-dummy-argument",
"-Wall",
"-Wno-align-commons",
"-Wmaybe-uninitialized",
"-flto",
"-I${workspaceFolder}/.vscode/linter",
"-I${workspaceFolder}/**",
"-I${workspaceFolder}\\**",
"-I./**",
"-I.\\**",
],
"fortran.linter.includePaths": [
"./**",
".\\**",
"${workspaceFolder}/**",
"${workspaceFolder}\\**"
],
"fortran.linter.modOutput": "${workspaceFolder}/.vscode/linter",
"fortran.fortls.suffixes": [
"f",
"inc",
".inc",
".INC"
],
"fortran.fortls.directories": [
"./**",
".\\**",
"${workspaceFolder}/**",
"${workspaceFolder}\\**"
],
It seems to me I have instructed fortls to always look everywhere. Have I missed something ? How can I have fortls / the linting process reliably find any .inc
in the whole source tree no matter where it is and where the .f
with the include statement is ?
Thanks for your help