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

variables values don't show in debug mode #432

Open
Vaillus opened this issue Oct 22, 2022 · 20 comments
Open

variables values don't show in debug mode #432

Vaillus opened this issue Oct 22, 2022 · 20 comments

Comments

@Vaillus
Copy link

Vaillus commented Oct 22, 2022

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 Vaillus added the bug label Oct 22, 2022
@Calinou
Copy link
Member

Calinou commented Oct 22, 2022

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.

@DaelonSuzuka
Copy link
Collaborator

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

@Calinou
Copy link
Member

Calinou commented Aug 12, 2024

@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 godotengine/godot#92632.

@Xkonti
Copy link

Xkonti commented Aug 12, 2024

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

@Xkonti
Copy link

Xkonti commented Aug 12, 2024

@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
Copy link

Xkonti commented Aug 13, 2024

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

@Calinou
Copy link
Member

Calinou commented Aug 13, 2024

@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.

@Xkonti
Copy link

Xkonti commented Aug 13, 2024

@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.

@DaelonSuzuka
Copy link
Collaborator

@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.

@Xkonti
Copy link

Xkonti commented Aug 17, 2024

@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.

@DaelonSuzuka
Copy link
Collaborator

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.)

@Xkonti
Copy link

Xkonti commented Aug 20, 2024

@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...

@Calinou
Copy link
Member

Calinou commented Aug 20, 2024

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.

@DaelonSuzuka
Copy link
Collaborator

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.

@robocad
Copy link

robocad commented Aug 23, 2024

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}

@clm805
Copy link

clm805 commented Sep 9, 2024

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, <-----------
        }
    ]
}

@DaelonSuzuka
Copy link
Collaborator

DaelonSuzuka commented Sep 9, 2024

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

@DaelonSuzuka
Copy link
Collaborator

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.

@clm805
Copy link

clm805 commented Sep 24, 2024

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

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

@robocad
Copy link

robocad commented Sep 24, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants