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

Debugger fixes for Godot 4.0 #400

Closed
wants to merge 12 commits into from
Closed

Debugger fixes for Godot 4.0 #400

wants to merge 12 commits into from

Conversation

RedMser
Copy link
Contributor

@RedMser RedMser commented Jul 30, 2022

Closes #389

See TODO list below for missing features. Changes include:

  • Add protocol to --remote-debug launch parameter
  • Add most new variant types
  • Data structures and commands were updated

TODO:

  • Missing variant types:
    • Projection
    • Callable
      • Should not show the "expansion" arrow in the inspector
    • RID
    • Signal
  • Allow configuring which Godot version to use, to keep compatibility with 3.x
    • Start out with an editor setting, but later this could be detected for the current workspace (e.g. via reading project.godot)
  • Variants need to handle ENCODE_FLAG_64
    • Only handled correctly for decoding. Encoding is done without this flag (bigint is the only exception).
  • Determine debug protocol tcp:// or ws:// or wss:// depending on settings
  • Variables and scene tree are not showing up
    • Variables do not update and sometimes duplicate
    • Scene tree nodes can not be inspected
  • Can not pause execution (only breakpoints work)
  • Commands probably changed more, need to go through them all

@Calinou Calinou added the bug label Jul 30, 2022
@Calinou
Copy link
Member

Calinou commented Jul 30, 2022

Determine debug protocol tcp:// or ws:// or wss:// depending on settings

I think it's fine to remove WebSockets support in a future release of this extension, as the LSP only used WebSockets until Godot 3.3 or so. Every version since Godot 3.3 should be using TCP now.

RedMser added 4 commits July 30, 2022 18:16
Uses code from NodeJS.
Can't update Node without also increasing minimum VSCode version.
@RedMser
Copy link
Contributor Author

RedMser commented Jul 30, 2022

the LSP only used WebSockets until Godot 3.3 or so. Every version since Godot 3.3 should be using TCP now.

@Calinou Isn't it still needed for debugging HTML5 games (disclaimer: I haven't done this in the past either)? I still see references in the WS module and the javascript platform.

@Calinou
Copy link
Member

Calinou commented Jul 30, 2022

@Calinou Isn't it still needed for debugging HTML5 games (disclaimer: I haven't done this in the past either)? I still see references in the WS module and the javascript platform.

True, although I don't think you can connect an external editor to the HTML5 editor (as a web browser cannot listen for incoming connections IIRC, even on LAN only).

@RedMser
Copy link
Contributor Author

RedMser commented Jul 30, 2022

Also how will versioning be realized for this extension? Since there are multiple breaking changes done here (such as new variants being added), making this code no longer backwards compatible. Ideas:

  • Keep old and new code bases merged in one, and detect/specify Godot version for the project (high code complexity)
  • Create new major version and branch, tell users to manually install an older version for 3.x support ("Install another version" menu item in the extension list)
  • Mark as pre-release (which adds a convenient "Switch to pre-release" button on the marketplace - but the wording is misleading)
  • Publish extension a second time (MS does this with "PowerShell" and "PowerShell Preview")

a web browser cannot listen for incoming connections

IIRC there's an option to tell Godot to start a temporary webserver for hosting the game. Not sure if that also handles remote debugging, or if it can be triggered externally using launch parameters (so that the VSCode extension can start it). But technically, this is certainly possible (browser connects to ws://localhost:6008 which is hosted by the Godot executable, then the game and Godot LSP are two-way connected).

@Calinou
Copy link
Member

Calinou commented Jul 30, 2022

Keep old and new code bases merged in one, and detect/specify Godot version for the project (high code complexity)

I think this would be the best approach, as a lot of Godot users will be hopping between Godot 3.x and 4.x for a while. Having to publish two extensions adds a lot of maintenance work, and they'll probably conflict with each other when activated at the same time (which is required if you want to hop quickly between projects).

RedMser added 5 commits July 30, 2022 19:20
Not sure about the state of websocket debugging for HTML5 games,
so this may not be necessary...
Currently, any JS variant (except bigint) is encoded without this flag.
@DaelonSuzuka
Copy link
Collaborator

@RedMser Is there anything I can do to help finish this PR? This is valuable work and I'd like to get it merged.

@RedMser
Copy link
Contributor Author

RedMser commented Oct 25, 2022

Is there anything I can do to help finish this PR?

@DaelonSuzuka I don't really have enough time or motivation to work on this right now.

The main thing holding this back, besides some issues with the debugger, is compat with 3.x.

Keeping compatibility with multiple Godot versions will probably double the size of this PR, due to having to create duplicates of every system (debugger, connection, etc.) which must be interchangeable. Not to speak of automatic version detection, which I'm not sure how it should be done just yet.

If you (or anyone else) is interested in continuing this, I'll gladly give push permissions (or you can create your own PR using this as a basis).

@DaelonSuzuka
Copy link
Collaborator

@DaelonSuzuka I don't really have enough time or motivation to work on this right now.

I think we're all pretty busy right now, so I definitely understand.

The main thing holding this back, besides some issues with the debugger, is compat with 3.x.

Sounds like a good place to hand it off, tbh. I already have some ideas about 3/4 interop since I'm about to port one of projects to 4beta3.

If you (or anyone else) is interested in continuing this, I'll gladly give push permissions (or you can create your own PR using this as a basis).

Since I'm barely git-literate, I think the safest thing will be for me to create a new branch based on yours.

Thanks for your contribution. I'll make sure it gets put to use.

@atirut-w
Copy link

Is it possible to infer 3 vs 4 from project.godot? That could be automated if it's possible.

@boruok
Copy link

boruok commented Jan 17, 2023

pr workable as is?

@atirut-w
Copy link

Dunno, but I think I figured out how to detect Godot version at least for 3 Vs 4: the .godot directory.

@DaelonSuzuka
Copy link
Collaborator

Work on this PR is continuing in #452.

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

Successfully merging this pull request may close these issues.

Unable to launch debugger with Godot 4 (workaround included)
5 participants