-
-
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
Editor Help: Improve appearance of script property setters/getters #80765
base: master
Are you sure you want to change the base?
Editor Help: Improve appearance of script property setters/getters #80765
Conversation
dalexeev
commented
Aug 18, 2023
•
edited
Loading
edited
- Extracted from Editor: Improve signal callback generation #79366 for easier review.
- Closes [4.0] GDScript custom class documentation doesn't mention name of setter / getter methods #68317.
editor/editor_help.cpp
Outdated
if (cd.properties[i].setter.begins_with("@")) { | ||
// GDScript inline setter. | ||
class_desc->add_text("<inline setter>" + TTR("(value)")); | ||
} else { | ||
class_desc->add_text(cd.properties[i].setter + TTR("(value)")); | ||
} |
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 added this to prevent user confusion. Ironically, the following code works:
call("@a_setter", 123)
53905a7
to
80497a9
Compare
## a description.
var a = 1:
set(value): a = value
get: return a
## b description.
var b = 2: set = set_b, get = get_b
func set_b(value): b = value
func get_b(): return b
## c description.
var c = 3: set = set_c, get = get_c
## set_c description.
func set_c(value): c = value
## get_c description.
func get_c(): return c |
Are you interested in reworking this PR, especially after your recent clean-up within EditorHelp? |
c93c32b
to
c0e4a54
Compare
c0e4a54
to
b946b74
Compare
@@ -1139,7 +1141,7 @@ void EditorHelp::_update_doc() { | |||
bool overridden_property_exists = false; | |||
|
|||
for (const DocData::PropertyDoc &prop : cd.properties) { | |||
// Ignore undocumented private. | |||
// Ignore undocumented private properties. | |||
const bool is_documented = prop.is_deprecated || prop.is_experimental || !prop.description.strip_edges().is_empty(); |
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.
While you're here
const bool is_documented = prop.is_deprecated || prop.is_experimental || !prop.description.strip_edges().is_empty(); | |
bool is_documented = prop.is_deprecated || prop.is_experimental || !prop.description.strip_edges().is_empty(); |
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.
Not a requirement, personal preference
const int argc = method.arguments.size(); | ||
const int skip_flags = skip_methods[method.name]; |
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.
const int argc = method.arguments.size(); | |
const int skip_flags = skip_methods[method.name]; | |
int argc = method.arguments.size(); | |
int skip_flags = skip_methods[method.name]; |
class_desc->push_cell(); | ||
_push_code_font(); | ||
class_desc->push_color(theme_cache.text_color); | ||
const bool has_setter_link = method_line.has(prop.setter); |
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.
const bool has_setter_link = method_line.has(prop.setter); | |
bool has_setter_link = method_line.has(prop.setter); |
class_desc->push_cell(); | ||
_push_code_font(); | ||
|
||
const bool has_getter_link = method_line.has(prop.getter); |
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.
const bool has_getter_link = method_line.has(prop.getter); | |
bool has_getter_link = method_line.has(prop.getter); |