1

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.

Ted Spradley
  • 3,414
  • 3
  • 22
  • 26

3 Answers3

1

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.

Grant
  • 11
  • 1
0

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?

Community
  • 1
  • 1
John De Santiago
  • 1,194
  • 7
  • 8
0

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!

tk_
  • 16,415
  • 8
  • 80
  • 90