Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature help with nested parentheses displays wrong argument from argument list #87

Open
JHenneberg opened this issue Apr 13, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@JHenneberg
Copy link

JHenneberg commented Apr 13, 2022

Highlighting of current paramter in signature help is broken.
This is happening only when the paramters are provided a way that involves a ,.
In this case by accessing a value of an array.

  subroutine foo(arg1, arg2, arg3)
    implicit none

    integer(4), intent(in) :: arg1, arg2, arg3

    write(*, *) arg1, arg2, arg3

  end subroutine foo

  subroutine bar()
    implicit none

    integer(4) :: arr(4, 4)

    arr = 0

    call foo(arr(2, 3), ...) ! results in the below image, the comma in `arr(2, 3)` is causing the problem
  end subroutine bar

image

@JHenneberg JHenneberg changed the title highlighting of current paramter when calling a function/subroutine broken highlighting of current paramter in signature help is broken Apr 13, 2022
@gnikit
Copy link
Member

gnikit commented Apr 13, 2022

This is part of the Signature help feature and I agree it needs work. The problem is that understanding literal nested scopes i.e. [2, 4, 5] or ar(1, 3) is a bit problematic. A while back I fixed this for simple literals (with the exception of complex numbers i think), but nesting them seems to be a big issue.

I have functions that are aimed at figuring these things out but robustly doing so is a bit of an issue.

@gnikit gnikit added the bug Something isn't working label Apr 13, 2022
@gnikit gnikit changed the title highlighting of current paramter in signature help is broken Signature help with nested parentheses displays wrong argument from argument list Apr 14, 2022
@folk85
Copy link
Contributor

folk85 commented Jun 20, 2023

@gnikit ,
I couldn't reproduce the bug in fortls 2.13.1.dev166+g1f54125 which I install with pip install git+https://github.com/fortran-lang/fortls.git
image

BUT, it is reproducable in fortls v2.13.0
image

So, could you advise me how to set unittest or set special flag to see both lines ( vriable and argument)?

@gnikit
Copy link
Member

gnikit commented Jun 22, 2023

@folk85 you can trigger the signature help, when you are typing the arguments of a function/subroutine and press ,. You would then be able to see the procedure's signature, and what argument you are meant to be typing.

@folk85
Copy link
Contributor

folk85 commented Jun 22, 2023

Yes, i see the signature help during typing, but i could not understand how generate unittest for this bug in dev build

@gnikit
Copy link
Member

gnikit commented Jun 22, 2023

Might want to have a look here to get some ideas https://github.com/fortran-lang/fortls/blob/master/test/test_server_signature_help.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants