-
-
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
Highlight doc comments in a different color #72751
Conversation
@@ -326,6 +326,11 @@ void CSharpLanguage::get_comment_delimiters(List<String> *p_delimiters) const { | |||
p_delimiters->push_back("/* */"); // delimited comment | |||
} | |||
|
|||
void CSharpLanguage::get_doc_comment_delimiters(List<String> *p_delimiters) const { | |||
p_delimiters->push_back("///"); // single-line doc comment | |||
p_delimiters->push_back("/** */"); // delimited doc comment |
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.
@@ -944,6 +944,8 @@ void CodeTextEditor::_complete_request() { | |||
Color font_color = completion_font_color; | |||
if (e.insert_text.begins_with("\"") || e.insert_text.begins_with("\'")) { | |||
font_color = completion_string_color; | |||
} else if (e.insert_text.begins_with("##") || e.insert_text.begins_with("///")) { | |||
font_color = completion_doc_comment_color; |
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.
Hmm, when would autocompletion ever use ##
or ///
as a prefix? And why not /**
? I see this already exist for normal comment delimiters, but I don't know where those might appear in autocomplete either...
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 don't remember comments ever being auto-completed either. But I didn't dare remove 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.
- With GDScript: Add
@deprecated
and@experimental
doc comment tags #78941 and GDScript: Highlight comment markers (TODO
,FIXME
, etc.) #79761 this might make sense.
Code looks great, at least on the GDScript side. I thought maybe we wouldn't want a separate function for comment delimiters, since we for example don't separate different string delimiter functions, but I'll leave details like that up to Paulb or the GDScripters I guess. After all, rn we have only one color for strings. I think it would be good if the color's RGB was also slightly tweaked instead of just a different alpha. Slight blue tint tends to look nice on comments, or maybe making the color a bit brighter idk |
@MewPurPur That's better? |
Maybe others would also want to bikeshed the defaults, but to me this seems perfect |
I like this one more; see also #71038. |
9b37727
to
ff7210d
Compare
Should comment markers (#79761) be highlighted in doc comments, or only in normal comments? |
I say they should.
|
ff7210d
to
2128ef8
Compare
2128ef8
to
54f356c
Compare
Is this going to be part of 4.2? |
This comment was marked as outdated.
This comment was marked as outdated.
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.
Tested locally (rebased on top of master
6916349), it works as expected. The code and chosen default colors look good to me.
Default | Godot 2 | Light |
---|---|---|
Note that folding regions are only created if the comment begins with a single #
, so there's no risk of ambiguity with colors (notice the gutter on the left):
No issues, glad it is implemented |
54f356c
to
de7cbe8
Compare
Thanks!
This was pre-approved and we're still before beta 1 so this seemed fine to include in the end. |
You have made my day |
Add
text_editor/theme/highlighting/doc_comment_color
editor setting and other changes in similar places.The following
CodeEdit
API has not changed (normal and doc comments are treated the same):Preview: