-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Add multiple programming language support to class reference #40613
Conversation
Does this take into account Godot versions without C#? |
Currently it always writes both. |
This will create unnecessary clutter for those who just use the GDScript version. Is there some way to hide it from the in-editor docs? You could try checking for the existence of the |
Isn't there a DEFINE for C# Support? If so, we could compile it conditionally. On the other hand, it might be overkill... |
None that I'm aware. |
I will see. I have to do some fixup either way. The static checks aren't happy with me :) |
0c79af2
to
5ac418e
Compare
@YeldhamDev fixed the clutter for non C# users. For C# users I still include both, because they can also use GDScript. As clayjohn stated on IRC, we should somehow add an option to chose which language is shown. Sadly this is easier said than done. |
65ab819
to
98e94d2
Compare
There's a But more than hardcoding this in editor code, it would be better to query the available script languages drop the engine to see which are included in the build. It could additionally be made configurable via an editor setting whether you want to see GDScript, C# (when available), or all. I'd also make the tags more explicit: |
Ok, I will add the editor option then. I have an idea for the the method names as well. Yeah the tags are a bit hacky, since I have to replace them with codeblock for the RTL :D. Will change their names too. |
@akien-mga Should I include the changed class doc xml as well? It's the one I used for testing, but done. |
98e94d2
to
c3319e8
Compare
Okay. I added two editor settings. One for making the class reference PascalCase (only the names of the DocData) and the other to select which examples should be shown. Options are GDScript, C#, and GDScript and C#. |
c477137
to
7d3a043
Compare
Fixed setter and getter methods not beeing pascal cased. I think it is pretty much done |
That should be in a separate PR (possibly proposal), there's a lot more involved than a simple snake_case to PascalCase conversion to provide a proper class reference for C#. Doing it only half-way is worse than not having the conversion IMO. |
Will do. |
7d3a043
to
5b51ae1
Compare
Forgot the done. :) Moved the PascalCase into a seperate PR |
Thanks! |
This adds the possibility to write examples in the class reference in C# and GDScript. It is actually a sideeffect of the wanted effect of having a possiblity to collapse the examples in the documentation. (See godotengine/godot-docs#3824)
The current behaviour is untouched. So using
[codeblock] ... [/codeblock]
behaves as it did before.However, I made it possible to do the following:
In the online class reference will that be rendered as:
text_editor/help/class_reference_examples: GDScript
text_editor/help/class_reference_examples: C#
text_editor/help/class_reference_examples: GDScript and C#
It would be nice, if the
[gdscript]
and[csharp]
tags could be used outside of codeblocks, but this will break the online reference. I will see if I find a way to set the programming language globally in the online class reference too. This would be useful to state binding specific differences which are currently here. Nonetheless that is probably a different PR.I will start adding examples to the class reference once verified.
I remember having read about this feature somewhere and reduz stated that in IRC.