Ted Spradley
Ted Spradley

Reputation: 3436

Eclipse IDE - Multiple line comment, uncomment for Apex code

I am working in Apex code on the Eclipse IDE for the Salesforce.com platform.

Is there a way to comment (or uncomment) multiple lines of code using two forward slashes easily?

Java shortcuts of Ctrl + Shift + / don't work in Apex that I can tell. I was hoping to find a method similar to the one in Xcode where you can highlight multiple lines, then Command + /.

I didn't find any threads dealing with Apex comments here on Stackoverflow, but will gladly take the whipping for not being thorough if someone is able to find it.

I specifically don't want to use the /* */ method of multiple line commenting because of the logical flaw with that method. I also don't want to explain that particular logic flaw at the moment.

Many thanks in advance, Ted S.

Upvotes: 1

Views: 2717

Answers (3)

tk_
tk_

Reputation: 17338

There are two types of commenting single-line and multi-line.

Single line

comment Ctrl + /

uncomment Ctrl + /

Multiline

comment Ctrl + Shift + /

uncomment Ctrl + Shift + \ (note the backslash)

Hope this helps!

Upvotes: 0

Grant
Grant

Reputation: 11

A workaround for commenting multiple lines (using //) which I am finding acceptable is to use Alt + Shift + A (windows, not sure what the Mac hotkey is) to turn on multi-line edit, then type the comment. Not being able to configure the hotkeys is very irritating, hope this helps some ppl.

Upvotes: 1

John De Santiago
John De Santiago

Reputation: 1214

I haven't found any of the shortcuts that would do this either but it occurred to me that maybe if you could get a macro or scripting plugin you could create your own hotkey. The following thread has some suggestions for potential macro plugins.

Is there a Macro Recorder for Eclipse?

Upvotes: 0

Related Questions