-
-
Notifications
You must be signed in to change notification settings - Fork 97
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 support for multiple line comment blocks in GDScript #1584
Comments
GDScript doesn't use a C-style syntax, so You can use multiline strings (
It would be possible to make them collapsible without adding a multiline comment syntax: #416 |
I am aware of the multiline strings. In my opinion using them as a substitue to a multiline comment potentially exposes proprietary info to end users since strings are included in the compiled "binary" while comments aren't (or shouldn't be anyway). |
Some languages with multi-line comments have migrated away from them. For example, in C#, the most common way to write multi-line comments is by having many lines which all start with |
Use |
@tx350z you are probably already aware, but ctrl + k (toggle comment state for selected text/block) may be a satisfying substitute. |
Yes, I am aware. |
Commenting with Ctrl + K has its issues (not sure if feature or bug): So, it doesn't seem to work for those comments which are inside blocks, so I'd focus on making single-line comment/uncomment to work regardless of whether multiple line comment blocks are added in GDScript. I'd personally make the comment/uncomment behavior consistent with VS Code (which is what makes it break in Godot editor for me, in fact). |
@Xrayez That's probably normal behavior. |
I agree to add multiline comments. Multiline strings the user/dev experience is very bad. |
If we do decide to have multi-line comments, I don't think we need multi-line comments though. |
hehe |
I understand that code commenting is out of favor. However, some things benefit from detailed commenting. The following is an example of why I'd like to see collapsible multi-line comments in GDScript. This is just one block of comments in a very large script file.
|
We don't need a special multi-line syntax to make that block collapsible in the editor though. |
It's already been done in 4.0-dev. Documentation comments were added in 4.0-dev. I really dislike multiline comments ( |
If that feature is coming in 4.0 then I'm good with it. |
That is a very common misconception. Just because they cannot be nested in C/C++ it doesn't mean they cannot be nested in general. It just depends on the language specification. For instance in Rust this is fully supported: Of course support for nested block comments requires a more complex grammar. Since GDScript is a hash commented language, it would be more natural though to use |
Case 1.
For example:
Case 2.
Multiline comments are evil. |
We discussed this proposal in a meeting. We found that this proposal lacked support among the community and contributors, so we won't be implementing this. Improvements to the Ctrl + K commenting system (to improve usability) are welcome though. |
I think the |
Doesn't godotengine/godot#79761 now make the case for this, since presumably single-line comments below a comment with a comment marker would be contextually independent and thus would surface incorrectly if there were any kind of future interface for browsing markers? |
The highlighting implemented in the script editor only affects the keyword, not the text associated to it. No effort is currently being made to highlight the associated text. That said, if this was to be implemented, it's possible to distinguish the associated text from further lines using a line break in the comment: # TODO: Something
# to be done in the future.
# This is still part of the TODO block.
#
# This isn't part of the TODO block (and neither is the line break above). If space alignment is used, it's even possible to distinguish the rest of the comment without a line break: # TODO: Something
# to be done in the future.
# This is still part of the TODO block.
# This isn't part of the TODO block. |
Great point. Apologies for rousing a closed issue, but it seemed worthwhile. |
Describe the project you are working on:
A MMORPG space game using a realistic ship GUI simulation. The main game display includes a large number of GUI controls with complex inter-dependencies.
Describe the problem or limitation you are having in your project:
"Self-documenting" code is fine for projects that have a small code base. My project involves many GUI elements with complex interdependencies. Single line comments are insufficient to document both the "what" and (more importantly) the "why" of functions and code blocks. Multiple single-line comments can be used but are not collapsible in the editor. When several lines of comments are present, actual code becomes buried.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Implement support for comment blocks found in most programming languages and allow the comment blocks to be collapsible like code blocks.
/** */
is a commonly used syntax though many others exist.Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
If this enhancement will not be used often, can it be worked around with a few lines of script?:
I personally will use this often and believe others will also.
Is there a reason why this should be core and not an add-on in the asset library?:
Not sure if it can be done as an add-on.
The text was updated successfully, but these errors were encountered: