godot-vscode-plugin icon indicating copy to clipboard operation
godot-vscode-plugin copied to clipboard

variables values don't show in debug mode

Open Vaillus opened this issue 3 years ago • 25 comments

Godot version

v3.4.4.stable.official.419e713a2

VS Code version

1.72.2

Godot Tools VS Code extension version

1.3.1

System information

Windows 11, wsl2 Ubuntu

Issue description

I downloaded the plugin in vscode marketplace which is connected to wsl in remote mode. I correctly put the absolute path of my godot installation in wsl, which allows me to run my project in debug mode from vscode.
The editor is well connected to the language model. Hovering the godot elements gives me access to their documentation in a floating winow. Everything seems to work normally except some features in debug mode:

  • The first breakpoint works fine but as soon as I want to continue I get the impression that it does not continue execution.
  • When I'm stopped at the first breakpoint, the call history is correctly displayed, but the variables don't load and I don't have access to the active scene tree. When I try to access the variables in the debug console, the variables have null values. (edit : I just noticed that variables contents are sometimes available when an error occurs instead of stopping at a breakpoint)

image

Steps to reproduce

Launch the project in debug mode from vscode and wait for the execution to stop at a breakpoint

Vaillus avatar Oct 22 '22 18:10 Vaillus

v3.4.4.stable.official.419e713a2

Godot 3.4.x is not supported for bug fixes anymore, so please upgrade to 3.5.1 and check if the issue still occurs there.

Calinou avatar Oct 22 '22 22:10 Calinou

@Vaillus Are you still experiencing this issue using godot-tools 2.0.0 (and ideally, Godot 3.5)?

DaelonSuzuka avatar Feb 28 '24 05:02 DaelonSuzuka

@xkonti Are you using 2.1.0 of this add-on? It was released recently: https://github.com/godotengine/godot-vscode-plugin/releases/tag/2.1.0

Also, check if this occurs when using Godot 4.2.2. This might be related to https://github.com/godotengine/godot/issues/92632.

Calinou avatar Aug 12 '24 21:08 Calinou

@Calinou Yes. Using 2.1.0 I'll check Godot 4.2.2 in a moment :)

Xkonti avatar Aug 12 '24 21:08 Xkonti

@Calinou

  • Works well with 4.2.2 Standard
  • Doesn't work with 4.3 RC 3 Standard
  • Doesn't work with 4.3 RC 3 .NET

Xkonti avatar Aug 12 '24 21:08 Xkonti

@Calinou BIG UPDATE: Variables show up with 4.3 RC 3 Standard, but the headless mode has to be disabled.

Xkonti avatar Aug 13 '24 14:08 Xkonti

@Calinou BIG UPDATE: Variables show up with 4.3 RC 3 Standard, but the headless mode has to be disabled.

What's the type of the variable you're inspecting? Types such as Texture2D are not usable in headless mode, as there is no GPU to access.

Calinou avatar Aug 13 '24 15:08 Calinou

@Calinou These were normal variables (float, Vector2). Basically, in headless mode there are no variables being displayed at all on the variables list in VSCode.

Xkonti avatar Aug 13 '24 19:08 Xkonti

@Xkonti Hold on, are you talking about the headless build of the engine, or the headless mode of the LSP? You mentioned 4.3 RC 3 Standard so it sounds like you mean the headless LSP mode.

DaelonSuzuka avatar Aug 17 '24 01:08 DaelonSuzuka

@DaelonSuzuka I meant the headless LSP. The option in the extensions' settings. Where you don't need to start up Godot gui to have the project in VSCode work and run with F5.

Xkonti avatar Aug 17 '24 07:08 Xkonti

I don't see how it's possible for LSP headless mode to affect debug sessions.

Share the contents of your launch.json. (For reference, you should have shared this when you first reported you had an issue.)

DaelonSuzuka avatar Aug 17 '24 11:08 DaelonSuzuka

@DaelonSuzuka This is the launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "GDScript: Launch Project",
      "type": "godot",
      "request": "launch",
      "project": "${workspaceFolder}",
      
      "profiling": false,
      "single_threaded_scene": false,
      "debug_collisions": false,
      "debug_paths": false,
      "debug_navigation": false,
      "debug_avoidance": false,
      "debug_stringnames": false,
      "frame_delay": 0,
      "time_scale": 1.0,
      "disable_vsync": false,
      "fixed_fps": 60,

      "additional_options": ""
    }
  ]
}

I needed to make sure that this setting is off: image

With that setting off, it works as intended (until either Godot or the connection to Gotod glitches out).

On another note, when running the project via F5 from VSCode it runs faster (as if time moved faster) than when started from the engine. Maybe 120Hz refresh rate confuses VSCode...

Xkonti avatar Aug 20 '24 21:08 Xkonti

On another note, when running the project via F5 from VSCode it runs faster (as if time moved faster) than when started from the engine. Maybe 120Hz refresh rate confuses VSCode...

This is because you have fixed_fps: 60 in launch.json. This makes Godot run with fixed FPS, which isn't what you want most of the time. It should not be confused with a framerate limiter (--max-fps N).

Use fixed_fps: -1 to make Godot launch with --fixed-fps -1, which makes it act as if that command line argument wasn't specified.

Calinou avatar Aug 20 '24 22:08 Calinou

fixed fps stuff

Or just don't specify options that you aren't intentionally trying to use.

Headless LSP mode

Why were you trying to run the LSP in Headless mode in the first place? I can't think of any way that this setting could even remotely cause the issue described, so maybe it's related to something else in your environment.

DaelonSuzuka avatar Aug 20 '24 23:08 DaelonSuzuka

Same issue here. Usage as editor for Godot works fine as well as running the scene from VSC using F5. Breakpoints work as well, only no variables show up at all. My setup and settings are posted below. No Headless mode or other settings changed.

OS: Linux x64 5.15.164-3-MANJARO Godot: v4.3.stable.arch_linux VS Code: 1.92.1 godot-tools extension: v2.1.0

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": "GDScript: Launch Project",
            "type": "godot",
            "request": "launch",
            "project": "${workspaceFolder}",
            "debug_collisions": false,
            "debug_paths": false,
            "debug_navigation": false,
            "additional_options": ""
        }
    ]
}

Godot settings: General->Text Editor->External->Use External Editor = On General->Text Editor->External->Exec Path = /usr/bin/code General->Text Editor->External->Exec Flags = {project} --goto {file}:{line}:{col}

robocad avatar Aug 23 '24 08:08 robocad

I had a similar issue, I fixed it by adding the "debugServer" field. as per the official docs.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "GDScript Godot",
            "type": "godot",
            "request": "launch",
            "project": "${workspaceFolder}",
            "port": 6007,
            "debugServer": 6006, <-----------
        }
    ]
}

clm805 avatar Sep 09 '24 20:09 clm805

@clm805 What docs? Using debugServer is not supported by this extension.

DaelonSuzuka avatar Sep 09 '24 20:09 DaelonSuzuka

I'm betting that this problem was related to typed arrays blowing up the debugger variables window. v2.2.0 was just published, which adds support for typed arrays. Please update your extension and let me if you're still experiencing this problem.

DaelonSuzuka avatar Sep 23 '24 17:09 DaelonSuzuka

@clm805 What docs? Using debugServer is not supported by this extension.

https://docs.godotengine.org/en/stable/tutorials/editor/external_editor.html#id1

clm805 avatar Sep 24 '24 07:09 clm805

I'm betting that this problem was related to typed arrays blowing up the debugger variables window. v2.2.0 was just published, which adds support for typed arrays. Please update your extension and let me if you're still experiencing this problem.

You seem right. It works now for me. Thanks!

robocad avatar Sep 24 '24 07:09 robocad