Skip to content

Hovering doesn't show interface in "external" subroutine #483

Open
@mcdc64

Description

@mcdc64

Hi,

I am working on a project that uses LAPACK (a linear algebra library) and used fortls's "source_dirs" to include the relevant paths to the directory:

VSCode Settings:

{
"fortran.fortls.directories": ["/home/cian/lapack/SRC/**","home/cian/lapack/BLAS/SRC/**","home/cian/sims/*"]
}

This works well to call subroutines from LAPACK and allow the subroutine's interface to be seen on hover, thus saving me having to look it up online. See snippet below:

! HOVER WORKS!
module implicitIntegrator
contains
    subroutine singleImplicitStep(dt, derivMatrix, phivals)
        implicit none(type, external)
        real dt
        real, allocatable, dimension(:) :: phivals, pivot
        real, allocatable, dimension(:, :) :: derivMatrix, identity, diffMatrix
        integer N, j
        integer rc

        call dgesv(N + 1, 1, diffMatrix, N + 1, pivot, phivals, N + 1, rc)

    end subroutine
end module

This snippet shows the subroutine's interface when I hover, as seen in this image:

Image

The problem, obviously, is that the actual code is missing a declaration for the subroutine, even though fortls knows where it is. And since the library I'm calling from has no mod files, I need to declare the subroutine as external to avoid compiler errors. So we add a line below implicit none(type, external):

! HOVER DOESN'T WORK
module implicitIntegrator
contains
    subroutine singleImplicitStep(dt, derivMatrix, phivals)
        implicit none(type, external)
        external dgesv
        real dt
        real, allocatable, dimension(:) :: phivals, pivot
        real, allocatable, dimension(:, :) :: derivMatrix, identity, diffMatrix
        integer N, j
        integer rc

        call dgesv(N + 1, 1, diffMatrix, N + 1, pivot, phivals, N + 1, rc)

    end subroutine
end module

But declaring it as external seems to prevent fortls from accessing the interface when I hover, either on the actual call or on the "external" declaration.

Image

Is this known behaviour? I haven't seen any issues that look similar; if this is a duplicate please close.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions