hansec / vscode-fortran-ls

Fortran IntelliSense for Visual Studio Code
MIT License
37 stars 7 forks source link

Hovering while debugging over nested derived data types does not work #28

Open gnikit opened 3 years ago

gnikit commented 3 years ago

Issue

I have realised that when debugging and hovering over objects with nested derived data types, no information is displayed except at the very top object.

Minimal example

test.f90

program test

   implicit none

   type t
      integer :: i = 0
   end type t

   type u
      type(t) j
   end type u

   type(u) :: var

   print*, var%j%i   ! <-- break here and hovering over j will do nothing

end program test

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "FORTRAN (gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/test.o",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "logging": {
                "engineLogging": true,
                "moduleLoad": true,
                "exceptions": true
            }
        },
    ]
}

Steps to replicate

  1. Compile test.f90 gfortran -g test.f90 -o test.o
  2. Place breaking point at line 15
  3. Run debugger and hover over j or i

Expected behaviour

Hovering over j in debugging should show type and contents of object.

Current behaviour

No hover message is displayed and debug adaptor throws this message when hovering over j

1: (3252) <-1040-var-create - * "j"
1: (3253) ->1040^error,msg="-var-create: unable to create variable object"
1: (3253) ->(gdb)
1: (3253) 1040: elapsed time 1

Other comments

I am not sure if this the language-server's job or the debugger adaptor's from C/C++, but I thought we should try and narrow it down since it will greatly improve the debugging experience in complicated pieces of code.

lineinthesand commented 3 years ago

I've also noticed that and what makes the problem even more severe is that when I click on the ">" to open one of the nested types, the new window that opens instead is at a completely different place such that it closes pretty quickly if I don't move the mouse lightning fast to the newly opened window or if I hover another symbol accidentally during the transit, even if only for a split second. My current workaround is that I defined a shortcut for Evaluate in Debug Console (Ctrl+Shift+Enter) that I can execute on some highlighted symbol.