godot icon indicating copy to clipboard operation
godot copied to clipboard

Add expression evaluater to debugger (REPL)

Open KoBeWi opened this issue 1 year ago • 2 comments

Supersedes #60134 Supersedes #76736 Closes https://github.com/godotengine/godot-proposals/issues/4473

For now it's just rebased branch, putting it as draft until I clean it up and fix issues.

KoBeWi avatar Sep 30 '24 15:09 KoBeWi

this feature should also be disabled in release build

This feature is a part of debugger. Does it even exist in release builds?

probably extracted as an EditorDebuggerPlugin

I can do that in a follow-up.

KoBeWi avatar Oct 01 '24 10:10 KoBeWi

This feature is a part of debugger. Does it even exist in release builds?

Yes the debugger is not fully disabled in release builds, only parts of it (like live scene editing), it's historically always been like that, but of course this should be re-evaluated

Faless avatar Oct 01 '24 11:10 Faless

Tested locally, the UI appears to be disabled regardless of whether the project is currently running:

image

I have a GDScript open in the script tab before running the project.

("Expression to evaluate" is a read-only LineEdit.)

Calinou avatar Oct 01 '24 14:10 Calinou

You can only evaluate when the game is breaked (at breakpoint, error etc.). Maybe this should be more obvious, but it can be improved later.

KoBeWi avatar Oct 01 '24 14:10 KoBeWi

Maybe the LineEdit could have a centered message in this case that says "To evaluate expressions, the project must be running with the execution interrupted by a breakpoint or error."

akien-mga avatar Oct 01 '24 14:10 akien-mga

Maybe the LineEdit could have a centered message in this case that says "To evaluate expressions, the project must be running with the execution interrupted by a breakpoint or error."

Wording suggestion: "Expressions can only be evaluated when a running project is paused in the debugger"

mathrick avatar Oct 01 '24 15:10 mathrick

Thank you.

rohanrhu avatar Oct 01 '24 16:10 rohanrhu

I forgot to say thanks when merging this, I had wrongly closed the tab /o\

Thanks to everyone involved in implementing this feature, @rohanrhu, @rxlecky and @KoBeWi!

akien-mga avatar Oct 01 '24 23:10 akien-mga

Great stuff, it's amazing to see this feature finally implemented, after I was unable to do so. Thanks @rohanrhu ! ❤️

rxlecky avatar Oct 12 '24 21:10 rxlecky

image

Hello, I've been using this feature on the Godot 4.4 dev 3 snapshot and I am loving this feature. And I have a potential newbie question.

Is there a way to see the Object value of Display.dealer_total just like how you can with dealt_card

GyuchanLim avatar Oct 26 '24 08:10 GyuchanLim

You should be able to see it in the inspector when you click the object.

KoBeWi avatar Oct 26 '24 13:10 KoBeWi

Google translate: Hello. Why not copy the python interpreter?

French original text: Bonjour. Pourquoi pas copier l'interpreteur python?

image

Musclorman avatar Jan 21 '25 14:01 Musclorman

Because it serves a different purpose. It's a tool for debugging a running project.

If you want a GDScript interpreter, you can use one available online, like https://gd.tumeo.space/

KoBeWi avatar Jan 21 '25 14:01 KoBeWi

This bug seems to have not been completely fixed 👀. Adding this comment here instead of opening a new PR since maybe we would like to simply re-open this PR :).

I've seen the following behaviors in Godot 4.5.beta1 (which supposedly includes this PR): (1) When evaluating expressions while inside a static function, the evaluator does not evaluate. (2) Additionally, not only does the evaluator not evaluate, but the debugger itself immediately continues running as if the user pressed "Continue".

Here is a test project to check it on: (as mentioned, please run this on Godot 4.5.beta1). godot-evaluator-static-bugs.zip

Behavior (1) is an important feature I believe should exist, but behavior (2) is especially concerning as I have also observed it when triggering the bug that this PR fixed (happened to me in Godot 4.4.1.stable) meaning that possibly any bug other users will encounter with the evaluator might have unintended side effects.

ineptNonsense avatar Jun 20 '25 20:06 ineptNonsense

Adding this comment here instead of opening a new PR since maybe we would like to simply re-open this PR :).

That's what issues are for.

KoBeWi avatar Jun 20 '25 21:06 KoBeWi

Adding this comment here instead of opening a new PR since maybe we would like to simply re-open this PR :).

That's what issues are for.

Then I shall be opening one pronto :)

ineptNonsense avatar Jun 20 '25 21:06 ineptNonsense