-
-
Notifications
You must be signed in to change notification settings - Fork 20.9k
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
Support object inspection through DAP #97585
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, please see changes to avoid including std:optional
.
As @AThousandShips pointed out, we might also want to remove the lambdas too (though there are some use in other editor code, we still try to avoid them, especially in combination with auto
).
4af18eb
to
a618232
Compare
a618232
to
4cea097
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 , nice work!
948a2fc
to
56c08f6
Compare
Whoops, I forgot about the This one is a bit trickier because Godot receives a plain string to evaluate, rather than a variable ID. This exists already for evaluating script tokens, so the result is the same here from Godot (the cursor isn't visible, but it is hovering the But I can actually easily store this mapping between variable name and DAP variable ID when the stack frame is being parsed, so it shouldn't be difficult to support this. So, while the |
56c08f6
to
870254b
Compare
Turned out to be simple indeed; I've implemented support for it when an evaluated variable has been parsed, please test to see if behavior is correct now. VSCode seems to be working correctly:
You can check this guide in the docs on how to set up LSP/DAP support on VSCode. |
As it's currently implemented, the evaluate expression only looks at any existing variable that matches the requested content. What you're asking for is REPL, which Godot doesn't support... yet; there's some activity around it, like #60134 (and #97647 which was open... just 4 hours ago 😁) |
Interestingly, evaluating expressions almost works in VS Code when using legacy non-DAP mode, which led me to believe it could be added to DAP mode as well. That said, I’m very happy with this pull request regardless. |
I see. I had a quick peek at the VSCode plugin, and keeping in mind I'm not familiarized with the codebase at all, I'd wager it is building an internal tree of variables when variable information comes, which is then used for this scenario when there is a variable access. So, it is something the addon itself is doing, and not Godot. Again, I can be completely wrong here, but if that's what the addon does, instead of replicating this from Godot, I'd wait to see if REPL functionality is implemented in the meantime, as it is a much better solution for this. EDIT: Ok, the PR I talked about was merged an hour ago, lol 🎉. I'll have a look to see if it can use this new system. |
This would replace the changes I did in the meantime for the |
870254b
to
66c2b7b
Compare
66c2b7b
to
9dd7a8a
Compare
Great! Tried it in Rider and VScode. Out of scope, but I'd rather ask, if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work as usual! Thanks for your dedication to maintaining the DAP support!
Closes #97182.
Implements object inspection through DAP. All object properties are bundled in Categories for organization, similarly to what is shown from Godot:
Object inspection is done in a lazy fashion, as the performance impact of querying them is quite significant. DAP IDs are generated for detected object types when parsing
Variant
s, and information is only requested from the debuggee when an explicitvariables
request is made.