-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Make GDScriptAnalyzer aware of properties from other languages #85703
Make GDScriptAnalyzer aware of properties from other languages #85703
Conversation
1a7162e
to
3159d14
Compare
3159d14
to
b96ccc9
Compare
Looks good, but I think it should also look for methods and signals. |
@vnen Methods are already handled somewhere else: godot/modules/gdscript/gdscript_analyzer.cpp Line 5006 in d76c1d0
I can add signals, though. Should I also add constants here? |
That is for direct calls. Methods can also be accessed like properties, which return a Callable.
Yes, constants should be included too. |
@TitanNano Hi and welcome around! Thanks for your PR, by the way. Could you join a simple test project? I'm wondering how we could test this PR before merging it. |
I think the easiest way to test is with C#, since it's already integrated in Godot. |
b96ccc9
to
92d316e
Compare
Do you have any pointers for me on how to get started with testing this? Especially with the mix of C# and GDScript. |
92d316e
to
124acf5
Compare
Looks good to me. I did test this with a C# project and it seems to work well. |
124acf5
to
7927b37
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. Thanks for working on this!
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.
Just some minor style nits, looks good otherwise
Co-authored-by: K. S. Ernest (iFire) Lee <fire@users.noreply.github.com> Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
c927b3b
to
030aa41
Compare
@AThousandShips I applied your suggestions. Perhaps this can get merged then? |
Thanks, and congrats on your first merged Godot contribution! PS. For future PRs, please make sure to follow the preferred style for commit messages (starting with a verb, etc). The title of the PR right now is a good option. You also don't need to include reviewers as co-authors 🙂 |
@YuriSizov thank you for the message. How do I backport / cherry-pick this for 4.2 and 4.1? Do I just open pull requests against these branches with a reference to this PR? I wasn't able to find specific documentation. |
@TitanNano You don't need to do anything if it's cherry-pickable without conflicts, we'll handle it. That said, the team hasn't expressed yet if this should be cherry-picked. |
I'm not sure if this is related to this PR or not, but I was going through the commits that went into 4.3 and this seemed like a possible source of the following regression. In where If I enable type checking in But if I use the This is a parse error, so I can't just disable warnings. I can get the code to parse correctly by using But this doesn't match the documentation on how cross-script method calls should work, and this is not backwards compatible with how it worked in 4.2 -- https://docs.godotengine.org/en/stable/tutorials/scripting/cross_language_scripting.html |
@DavidVonDerau there is #86259 which should fix this problem. |
Cherry-picked for 4.2.2. |
GDScript's auto-completion is aware of properties from scripts in other languages (integrated via GDExtensions) but the GDScript analyzer will report the property as unknown.
The analyzer only ever checks the GDScript class and the native-type of an object for properties. The script type is currently ignored.
(this fix should also be compatible with at least 4.2 and 4.1)