fortls icon indicating copy to clipboard operation
fortls copied to clipboard

line continuation at beginning of the line trips the tooltip information

Open smoothdeveloper opened this issue 1 year ago • 1 comments

integer(8) function foo(i,j
& ,k)
    foo = i+j+k
end function

At call sites, this function tooltip will incorrectly show no arguments.

If the continuation character is put at the end of the line, it works properly.

I'm dealing with a sizeable codebase where the continuation character is always put at the beginning of the next line.

Environment:

  • fortls-2.13.0
  • windows 11
  • vscode 1.87.2

Related: #235, #85

smoothdeveloper avatar Mar 28 '24 20:03 smoothdeveloper

It seems code in .f90 files don't require the "&", so this is minor issue (we should 100% encourage migrating to modern fortran format).

It would be great if the language server had newcomer suggestions, that would be displayed first time a condition about legacy code or non recommended things occurs in the code, and the user could disable the notification forever.

I don't know if this fits more the LSP or the individual editor extensions.

smoothdeveloper avatar Apr 05 '24 16:04 smoothdeveloper

I am not sure the posted code is legal Fortran. Free Form Fortran, which is what I am assuming this is from the usage of .f90, requires & as the last non whitespace character to mark the next line as a continuation. The hover request displays correctly, where the i and j arguments are omitted from the explicit declaration since you use implicit typing.

image

I will be closing this Issue for now. If to reopen can you post a complete MWE and how you compile it, and the debug command from a terminal with its output vs the expected output.

The latter should look something like this:

fortls --debug_filepath line_continuations_p2.f90 --debug_rootpath . --debug_hover --debug_line 1 --debug_char 23
Testing "initialize" request:
  Root = "."
[INFO - 20:26:19] fortls - Fortran Language Server 3.0.0rc7.dev1+g8b511d5 Initialized
================================================================================
  Successful!

  Source directories:
    /home/gn/Code/Python/fortls/test/test_source/parse
================================================================================

Testing "textDocument/hover" request:
  File = "line_continuations_p2.f90"
  Line = 1
  Char = 23

================================================================================
```fortran90
FUNCTION foo(val) RESULT(r)
 REAL(8), INTENT(IN) :: val
 REAL*8 :: r
```
================================================================================

gnikit avatar May 11 '24 19:05 gnikit