2

This is a quality of life question that might be awfully simple, but, I cannot seem to find an answer for it.

If you start a block comment...

/*
my code here
string url = "lorumipsum....*/...lorumipsum"; <---this "*/" is closing the comment early
more code
*/

It gets closed by any "*/" in a string. Is there a way to escape this? Or do I just manually "//" the line and block comment the rest?

Max
  • 5,799
  • 3
  • 20
  • 27
  • 1
    You can select all text and comment from top in the toolbar. It will add // in front of all selected lines. – Nikhil Agrawal Aug 03 '15 at 13:49
  • As I don't know a way around this, this is the reason I never found multiline-comments that useful... – M463 Aug 03 '15 at 13:52
  • The reason is obvious: what is inside comment is not *parsed* and thus it can't detect whenever `*/` is inside string or not. It just looking for `/* .... */` and completely ignores anything inside. Ignoring what is commented make sense. – Sinatr Aug 03 '15 at 13:53

2 Answers2

4

You can select all text and comment from toolbar (Shortcut: Ctrl + K + U). It will add // in front of all selected lines like this.

///*
//my code here
//string url = "lorumipsum....*/...lorumipsum"; <---this "*/" is closing the         comment early
//more code
//*/

No need to do this manually.

Toolbar Image
enter image description here

mx0
  • 6,445
  • 12
  • 49
  • 54
Nikhil Agrawal
  • 47,018
  • 22
  • 121
  • 208
3

Or, you can just hold down the Alt-key, click and draw across all lines that you would like to comment out and then just type // before them as you are in Multiline-Editmode.

M463
  • 2,003
  • 3
  • 23
  • 39