-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 Block Comment Syntax #1401
Add Block Comment Syntax #1401
Conversation
I won't fight this but I never missed the defacto missing block comment from Ruby. Any sane editor should have a toggle comment shortcut and whether I hold shift while going down to the closing position of the block comment or not doesn't make that much of a difference. In fact |
I agree with @jhass . We didn't bother adding or thinking about block comments because we find it much easier and faster to just select a region of code and press "your shortcut for commenting code". Having to mark the beginning of the comment, and then the end of it is slower. And then inevitably someone will want these comments to be able to nest, because if you comment a large piece of code that has these kind of comments, it won't work. It's not hard to do, but I never really felt the need for that. I do, however, find that inserting a comment between expressions could be useful for quick debugging. But if that's the only use case, I wouldn't include this feature. |
I never use my editor to do that, but I don't mind typing |
Wanted to give it a few days, but with no support I'm not going to push for this. I'll close it out to keep the pr list trimmed. |
I would like the |
Honestly this should've just have gotten merged. |
@asterite, you can uncomment multiple lines via your IDE yes. But that's only if your IDE supports it, some terminal text editors don't. More importantly, with line comments you will never be able to do this:
Sometimes I temporarily comment out parts of lines. I might be the only one that does stuff like that though. |
Most terminal text editors should support bulk comments. If yours doesn't, maybe you should look for one with more features? To me this sounds like a very basic feature for code editing, even when a language also has block comments. Commenting parts of a line doesn't look like a strong use case. I'd never use that. Instead the individual expressions should be split into separate lines and then you can comment entire lines. That seems more reasonable than commenting out inner parts of a line. Overall I don't see much of a benefit, actually, for having block comments. Instead, it comes with a number of disadvantages: IDEs and syntax highlighters would have to be adapted to support it. And people would have to learn the new syntax, even if most probably don't have much desire to use it. You're the first one asking for block comments since this PR was closed 5 years ago. So it doesn't seem there's a huge demand for that. |
If you insist, this is what I discovered while investigating #11392: #<loc:push>#<loc:"
__ _
/ _| ___ ___ | |__ __ _ _ __
| |_ / _ \ / _ \| '_ \ / _` | '__|
| _| (_) | (_) | |_) | (_| | |
|_| \___/ \___/|_.__/ \__,_|_|
",1,1>#<loc:pop>
puts#<loc:push>#<loc:"
this is a comment
",1,1>#<loc:pop> 1 #<loc:push>#<loc:"
another comment
",1,1>#<loc:pop> + #<loc:push>#<loc:"
!!!!
",1,1>#<loc:pop> 2 + #<loc:push>#<loc:" ?????????? ",1,1>#<loc:pop> 4 # => 7 (please don't actually do this) |
I looked through this comment comparison list for languages that used
#
for inline comments, to see if any of their block comments felt right to me.I wanted something that still had the
#
char, so ruby==begin ==end
was out. Some were close, lisp#| BlockComment |#
, and cobra/# BlockComment #/
, and awk<# BlockComment #>
.However I think it's nice to have both "start block comment" and "end block comment" start with
#
so you can toggle sections quickly, by only editing one of the pair, so I came up with this.