-
-
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 C# Editor Documentation #40631
Add C# Editor Documentation #40631
Conversation
// C# | ||
bool first_is_underscore = p_name[0] == '_'; | ||
String result = p_name.capitalize(); | ||
return (first_is_underscore ? "_" : "") + result.replace(" ", ""); |
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.
Maybe we should make a method on String to do this? I think it would be more efficient, we could make a method that doesn't involve string splitting and re-concatenation - we can simply capitalize every letter after _
(and at the beginning) and then afterwards do a find/replace "_"
with ""
(except keep one at the beginning if there was one).
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.
I'd try to benchmark that code to see if it's an actual bottleneck first (even using good old OS::get_singleton()->get_ticks_usec()
). Adding more code to the String class should be done cautiously.
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.
Will do, but this code is not executed in a performance critical part of the engine. I can test wheter or not a iteration above the whole string is faster
Please add C# related macro checking, this features should not exist in the engine without C# support. |
|
I'm not necessarily against this, but it's not the ideal way:
IMO, the best would be to generate these from the information we get from the API assemblies and their generated |
Also -not a blocker either as this can be done incrementally in future PRs- but it would be better if this wasn't hard-coded in |
Closing due to lack of consensus as discussed above, and as this has been gathering dust for a while. Thanks for contributing. :) |
The user can select, how the reference should be rendered in the editor settings.
text_editor/help/class_reference_language: GDScript
text_editor/help/class_reference_language: C#
The conversion to PascalCase is done automatically.
This is moved out of #40613