Configure include paths for linting in vscode

I installed the fortran standard library with the .mod files found in /usr/local/include/fortran_stdlib/GNU-14.2.1, for example /usr/local/include/fortran_stdlib/GNU-14.2.1/stdlib_sorting.mod.
I have a small example program and as you can see there are these error sqilggles:

However with cmake it compiles just fine, also with gfortran main.f90 -I/usr/local/include/fortran_stdlib/GNU-14.2.1 -L/usr/local/lib -lfortran_stdlib

So it is just a matter of telling fortls where the library is located. I tried

    "fortran.linter.includePaths":[
        "/usr/local/include/fortran_stdlib/GNU-14.2.1"
    ]

to no avail. Does someone with a little experience with this have any idea?

EDIT: Here is the program:

program example_ord_sort
    use stdlib_sorting, only: ord_sort
    implicit none
    integer, allocatable :: array1(:), work(:)
  
    array1 = [5, 4, 3, 1, 10, 4, 9]
    allocate (work, mold=array1)
    call ord_sort(array1, work)
    print *, array1   !print [1, 3, 4, 4, 5, 9, 10]
end program example_ord_sort

and the fortran stdlib can be found here: GitHub - fortran-lang/stdlib: Fortran Standard Library

1 Like

I scolled through this entry yesterday. And just as I visited today, I found this message which might be relevant:

So I also tried adding the path to the source to the linter:

    "fortran.fortls.directories":[
        "/usr/local/include/fortran_stdlib/GNU-14.2.1",
        "/usr/local/include/fortran_stdlib",
        "/popos/home/caspar/Documents-old/code/fortran/stdlib/**",
        "/popos/home/caspar/Documents-old/code/fortran/stdlib/src/**"
    ]

It didnt seem to help either unfortunately.

Using these settings I actually get tooltip info, just the error squiggles stay for some reason:

Also if I click on a method eg. ord_sort it will actually locate it in the source :smile:, just the error squiggle stays for some reason. I could not find a way to deactivate them.

The life hack to disabeling the error squiggles is to set them to transparent:

    "workbench.colorCustomizations": {
        "editorError.foreground":   "#00000000",
        "editorWarning.foreground": "#00000000",
        "editorInfo.foreground":    "#00000000"
    }