hansec / fortran-language-server

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

Find reference doesn't work #192

Closed ZedThree closed 3 years ago

ZedThree commented 3 years ago

Finding references doesn't seem to work, although finding definitions does. Here's an MVCE:

Using fortls --version: 1.12.0 with the following file as lsp_mvce.f90:

program mvce
  implicit none
  call hello
contains
  subroutine hello
    print*, "Hello, World!"
  end subroutine hello
end program mvce
$ fortls --debug_rootpath . --debug_references --debug_filepath lsp_mvce.f90 --debug_line 5 --debug_char 13

Testing "initialize" request:
  Root = "."
  Succesful!

  Source directories:
    .

Testing "textDocument/references" request:
  File = "lsp_mvce.f90"
  Line = 5
  Char = 13

  Result:
    No result found!

Finding the definition does work:

$ fortls --debug_rootpath . --debug_definition --debug_filepath lsp_mvce.f90 --debug_line 3 --debug_char 11

Testing "initialize" request:
  Root = "."
  Succesful!

  Source directories:
    .

Testing "textDocument/definition" request:
  File = "lsp_mvce.f90"
  Line = 3
  Char = 11

  Result:
    URI  = "file://lsp_mvce.f90"
    Line = 5
    Char = 14
ZedThree commented 3 years ago

Sorry, off-by-one error on my half!