Commenting lines, commenting multilines, uncommenting lines ect..
If you’re a SE|PY user you probalby know that actually there are 2 different menu items for commenting/uncommenting code (and also 2 different key shortcuts).
I received different requests for change this thing. Some people ask me to make a unique shortcut/menu for commenting and uncommenting code, and also make 2 different way of add comment (one for ‘//’ comment and the other for ‘/*’ comment).
In this way, if you hit “comment” on a line:
_root.gotoAndStop(1);
it will become
// _root.gotoAndStop(1);
and, if you hit again on “comment” with the selection in the same line it will turn back to _root.gotoAndStop(1);
No problem in fact with single line selection.. but if you hit “comment” on a multiline selection like:
_root.gotoAndStop(1); //play();
another_line();
what should be the result?
1st solution: Detect line by line, if line is commented then uncomment it, otherwise comment line //_root.gotoAndStop(1);
play();
//another_line();
or 2nd solution Detect first line of the selection, if this line is commented, then try to uncomment all the lines in selection, otherwise comment every line of selection
//_root.gotoAndStop(1);
//play();
//another_line();
there is also a discussion in the developement mailing list, I’m not completely sure which is the best solution, even i prefer the second one.. I would like to know your opinion