Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to put double slashes next to code, and after all tabs?(Putting // just before the very first character of the line of code, instead of placing it at the very beginning of the line.)
How to put double slashes next to code, and after all tabs? [message #1737273] Wed, 06 July 2016 18:53 Go to next message
Taro Kyo is currently offline Taro KyoFriend
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.

http://i.imgur.com/QylrJiK.png

When commenting out the specified line using CTRL+/, I get this:

http://i.imgur.com/eCDEZs3.png

This is what I wanted to do:

http://i.imgur.com/E9BXicu.png

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:

http://i.imgur.com/cb8uD7z.png

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 #1737579 is a reply to message #1737273] Sun, 10 July 2016 16:25 Go to previous messageGo to next message
Taro Kyo is currently offline Taro KyoFriend
Messages: 8
Registered: July 2016
Junior Member
I have decided to post a feature request on Bugzilla. You can find the feature request here:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=497628
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 Go to previous messageGo to next message
David VavraFriend
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 #1737589 is a reply to message #1737585] Mon, 11 July 2016 04:17 Go to previous messageGo to next message
Taro Kyo is currently offline Taro KyoFriend
Messages: 8
Registered: July 2016
Junior Member
I didn't know the feature where // inserted at the first character of the line would increase project complexity. Prior to your post, I thought it's weird given how it would comment code by inserting // at the beginning of the line and not inserting at the first character.

And I didn't want it inserted on the first indented block level. That's not what I wanted at all. That is only an example showing that the // are inserted at the first character of the line, which is what I wanted. I should be more clear next time.

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 Go to previous messageGo to next message
David VavraFriend
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

Re: How to put double slashes next to code, and after all tabs? [message #1738914 is a reply to message #1737592] Tue, 26 July 2016 06:14 Go to previous message
Taro Kyo is currently offline Taro KyoFriend
Messages: 8
Registered: July 2016
Junior Member
Hello, I sort of changed it:

http://imgur.com/7cyvcTP.png

I hoped this is clear and concise enough.
Previous Topic:Arduino plugin don't find queue.h on using ESP8266WiFi.h
Next Topic:Yocto ADT : How to build without Autotools/CMake
Goto Forum:
  


Current Time: Thu Sep 19 09:43:43 GMT 2024

Powered by FUDForum. Page generated in 0.04233 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top