hansec / fortran-language-server

Fortran Language Server for the Language Server Protocol
MIT License
295 stars 57 forks source link

Signature help - array constructor/function call not recognised as argument #178

Open michaelkonecny opened 3 years ago

michaelkonecny commented 3 years ago

Hello, hope you're good.

If I have a subroutine such as

subroutine mySubroutine(a, b, c, d, e)
    ! ...        
end subroutine

and I'm writing a call to it, like this:

call mySubroutine(a, [1, 2, 3], c)

my cursor being just behind c and I invoke signature help, it doesn't seem to recognise the array constructor [1, 2, 3] as a single argument. Instead it thinks I'm already at the 5th parameter (e), probably because four commas have preceded.

The same thing happens with the old-fashioned array constructor:

call mySubroutine(a, (/1, 2, 3/), c)

If I try to use a result of a function as an argument, the same behaviour occurs:

function myFunction(a, b, c, d, e) result(x)
    ! ...        
end function

x = myFunction(a, myFunction(a, b, c), c)

I guess the function call parser can't really recognise objects that can return temporary variables. This could be improved.