# Configure include paths for linting in vscode

**URL:** <https://fortran-lang.discourse.group/t/configure-include-paths-for-linting-in-vscode/8922>\
**Category:** Visual Studio Code\
**Created:** [December 4, 2024, 6:12am UTC](https://fortran-lang.discourse.group/t/configure-include-paths-for-linting-in-vscode/8922 "2024-12-04T06:12:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheFibonacciEffect](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/thefibonaccieffect/32/5390_2.png) [@TheFibonacciEffect](https://fortran-lang.discourse.group/u/TheFibonacciEffect)\
**Post date:** [December 4, 2024, 6:12am UTC](https://fortran-lang.discourse.group/t/configure-include-paths-for-linting-in-vscode/8922/1 "2024-12-04T06:12:58Z")

</div>

I installed the [fortran standard library](https://github.com/fortran-lang/stdlib) 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:

 ![image](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/0/03f9c8feb612abc686a27ee0b5c6df797a9d2856.png)

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

```auto
    "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:

```auto
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](https://github.com/fortran-lang/stdlib)

---

<div class="post-metadata">

**Author:** ![TheFibonacciEffect](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/thefibonaccieffect/32/5390_2.png) [@TheFibonacciEffect](https://fortran-lang.discourse.group/u/TheFibonacciEffect)\
**Post date:** [December 4, 2024, 10:44am UTC](https://fortran-lang.discourse.group/t/configure-include-paths-for-linting-in-vscode/8922/2 "2024-12-04T10:44:07Z")

</div>

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

> [@Modern Fortran on VSCode fails to recognize external includes](https://fortran-lang.discourse.group/t/modern-fortran-on-vscode-fails-to-recognize-external-includes/5600/5):
>
> fortls cannot read .mod and .smod files since they are compiler vendor and compiler version dependant. It can only parse Fortran sources, consequently if no sources for module are found in your source tree then it will raise an Info message saying that they are missing.

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

```auto
    "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:

 ![image](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/1/189c99720765fc9e45bfda986904f81be297f61f.png)

Also if I click on a method eg. `ord_sort` it will actually locate it in the source 😄, 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:

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

```
