I have a very simple project that I’m using to make sure I understand how to use fortls. The root contains main.f90, and there is one subdirectory called “src” with
constants.f90, constants.mod, classes (another subfolder)
I created a .fortls file in the root and it just has 2 lines:
“source_dirs”: [“src”, “src/classes”],
“ext_source_dirs”: [“src”]
(I’m just trying anything at this point).
When I try “use constants” in main.f90 it gives me error about not being able to locate “constants.mod”.
I don’t think there are any issues with my fortls installation. I had some issues where I got an error starting fortls due to setting the PATH variable incorrectly, but now I consistently get the “fortls initialization complete” message.
I’ve read a lot of forum posts and can’t seem to figure out the issue, so any help is much appreciated. I don’t want to have a root directory crammed with all my modules!
EDIT:
I actually found the solution. It wasn’t a fortls issue I was tracking down, but actually a linter problem. I added a settings.json file and inserted the line
“fortran.linter.includePaths”: [“./**”]
So now vsCode finds the .mod files I want.
I suppose this does raise one clarification I need: what is the difference between fortls and the linter? I thought that fortls is the linter.