godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.51k stars 151 forks source link

Removing breakpoints in VSCode doesn't work #518

Open CatarinaPBressan opened 10 months ago

CatarinaPBressan commented 10 months ago

Godot version

4.1.1

VS Code version

1.83.1

Godot Tools VS Code extension version

1.3.1

System information

Windows 10

Issue description

Adding breakpoints on VSCode correctly adds breakpoints in Godot and the game stops at the correct place when running through VSCode, but removing breakpoints on VSCode doesn't work sometimes: The game pauses in the line that was previously set as a breakpoint, and the breakpoint still shows in the Godot editor.

Saving the file after removing the breakpoint sometimes removes the breakpoints, but not always.

Steps to reproduce

  1. Add a breakpoint through VSCode
  2. Run the game through VSCode, the game should stop at that breakpoint
  3. Remove the breakpoint through VSCode
  4. Run the game again through VSCode, the game should stop again at that breakpoint (at this point you can check the Godot editor and the breakpoint will still be there)

or:

  1. Add a breakpoint through VSCode
  2. Run the game through VSCode, the game should stop at that breakpoint
  3. Remove the breakpoint through VSCode, and save the file (I usually save with the shortcut Ctrl+S)
  4. Run the game again through VSCode, the game should not stop again at that breakpoint. (at this point you can check the Godot editor and the breakpoint will be removed)
LeifintheWind commented 8 months ago

I believe I'm having the same issue. Where adding a breakpoint in VScode works fine, but attempting to remove it then run the debug again and the breakpoint reappears!

I did notice that if the breakpoint is removed while the debugger/scene is running, it does successfully and consistently remove the breakpoint. Attempting to remove the breakpoint when the debugger/scene is not running is entirely unsuccessful for me.

DaelonSuzuka commented 8 months ago

@CatarinaPBressan @LeifintheWind Please post the contents of your launch.json.

CatarinaPBressan commented 8 months ago

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "GDScript Godot",
            "type": "godot",
            "request": "launch",
            "project": "${workspaceFolder}",
            "port": 6006,
            "debugServer": 6006,
            "address": "127.0.0.1",
            "launch_game_instance": true,
            "launch_scene": false
        }
    ]
}
LeifintheWind commented 8 months ago
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "GDScript Godot",
      "type": "godot",
      "request": "launch",
      "project": "${workspaceFolder}",
      "port": 6006,
      "debugServer": 6006,
      "address": "127.0.0.1",
      "launch_game_instance": true,
      "launch_scene": false
    }
  ]
}
DaelonSuzuka commented 7 months ago

This is a known problem with using the debugServer setting. debugServer invokes a completely different debugging protocol between between VSCode and Godot, and it's use isn't really supported (yet).

The only thing I can recommend is waiting for the new version of this extension to be published (which I hope is soon), because I've almost entirely rewritten the debugger interface and it works much better than the old one.

mberdev commented 7 months ago

Same issue in Godot 4.2.1. I'm indeed using debugServer. But I thought it was mandatory. How do you NOT use it? When I don't use it I got a whole other set of issues.

DaelonSuzuka commented 7 months ago

@mberdev

But I thought it was mandatory

Why do you think that? It's never been recommended or listed in this extension's documentation.

How do you NOT use it?

By waiting for the new version of godot-tools to be published.

When I don't use it I got a whole other set of issues.

Yes, that's why I spent most of last year rewriting the extension's debugger interface.

bimbio commented 7 months ago

Temporary workaround is to just type 'breakpoint' before the line you want to debug, instead of clicking the red dot thing on the side. Then when you're done with debugging just delete the line from your code.

LeifintheWind commented 7 months ago

Thanks for your hard work @DaelonSuzuka !

mberdev commented 7 months ago

@mberdev

But I thought it was mandatory

Why do you think that? It's never been recommended or listed in this extension's documentation.

How do you NOT use it?

By waiting for the new version of godot-tools to be published.

When I don't use it I got a whole other set of issues.

Yes, that's why I spent most of last year rewriting the extension's debugger interface.

To you it's obvious the difference between the several debugging systems, but to regular people it's not. We just follow tutorials titled "How to set up Godot 4.2 with VSCode" after trying to make it work by ourselves and failing.

Therefore, allow me to rephrase my question :

Is there a way to use VSCode with GDScript? i.e. a way that lets you:

CatarinaPBressan commented 7 months ago

FWIW I started using Godot 4.2 in the meantime and this is still the only issue that I've run into. The plugin is perfectly usable otherwise, and hits the other 2 bullet points.