How to put double slashes next to code, and after all tabs? [message #1737273] |
Wed, 06 July 2016 18:53 |
Taro Kyo Messages: 8 Registered: July 2016 |
Junior Member |
|
|
In Eclipse IDE (Java and C/C++), pressing CTRL+/ will comment out a line of code, or selected lines of code, by adding // (double slashes) to the very beginning of the line.
I would like to find a way to put // (double slashes) at the position of the first character of a code, instead of placing it at the very beginning of the line.
Does anyone know? Thanks in advance.
Here is an example code used to demonstrate the process.
When commenting out the specified line using CTRL+/, I get this:
This is what I wanted to do:
Notice the // (double slashes) are located at the first character of the line of commented code. That is where I wanted the // (double slashes) to be.
Another bigger example:
Other than manually typing the // (double slashes) out, I wanted to tweak the shortcut, CTRL+/, so that it can put the // (double slashes) at the very first character of the line of codes.
How can I do this? Thanks in advance.
[Updated on: Thu, 07 July 2016 03:07] Report message to a moderator
|
|
|
|
Re: How to put double slashes next to code, and after all tabs? [message #1737585 is a reply to message #1737579] |
Sun, 10 July 2016 20:12 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
Frankly, I would think any change from the current behavior would be just an increase in project complexity with little benefit in return. Lots of potential options here (along with potential future maintenance headaches). For example at the beginning of the text on a line versus what you apparently want, that is, placed at the the first block level selected. Plus the current action, of course. How about inserting a #if 0 .. #endif, too but also retain the current mode of operation without having to change any settings?
Defining what should happen if there was an indented comment might be tricky. Currently, it will not toggle unless all lines have // in columns one and two or none at all. Otherwise, it adds //. Which means sections contain previously commented out code must be omitted from the selection (or not) depending on how the user wants them to be treated. Yet another possible option.
Regardless of what is decided, there will always be that one person who wants something different. Like the person who recently didn't want to have to move his hand from the debugger F6 (Step) key to the Continue button when reaching a line of code that will transfer to the exit code because he didn't want the debugger to step into the exit code. The same problem with stepping into any library function without the library source but perhaps that hasn't occurred to him yet.
Currently, you could, using the column mode, draw a line where you want the comment slashes and type "// ". Not any harder than selecting the lines and hitting CTRL+/. Removing them would be simple, too. Just select the "// " in column mode and hit DEL. Doing these gets what you want and and doesn't depend on built-in guesses.
|
|
|
|
Re: How to put double slashes next to code, and after all tabs? [message #1737592 is a reply to message #1737589] |
Mon, 11 July 2016 05:34 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
Of course it increases complexity. Each binary option doubles the number of possible configurations. It rapidly rises to the level where even automated testing becomes infeasible.
BTW: look at your image with the "DO WANT!!" starting at line 35. It clearly has the comment slashes being place at the block level. Note the spaces following the slashes in lines 35-37. It's also the same image in your change request. If that's not what you really want you should at least correct the change request.
FYI: the first character on the line is a space (or tab). It is also the beginning of the line. The current action already places the slashes prior to the first character on the line. You apparently meant "first non-whitespace character". You might want to correct that as well.
[Updated on: Mon, 11 July 2016 16:31] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02570 seconds