How to comment a block in Eclipse?

前端 未结 17 2106
一整个雨季
一整个雨季 2020-12-07 08:52

Does Eclipse have a hot key to comment a block? and to uncomment a block?

相关标签:
17条回答
  • 2020-12-07 09:21

    For single line comment just use // and for multiline comments use /* your code here */

    0 讨论(0)
  • 2020-12-07 09:24

    Ctrl-/ to toggle "//" comments and Ctrl-Shift-/ to toggle "/* */" comments. At least for Java, anyway - other tooling may have different shortcuts.

    Ctrl-\ will remove a block of either comment, but won't add comments.

    Note: As for Eclipse CDT 4.4.2, Ctrl-Shift-/ will not uncomment a "/* */" block comment. Use Ctrl-Shift-\ in that case.

    EDIT: It's Ctrl on a PC, but on a Mac the shortcuts may all be Cmd instead. I don't have a Mac myself, so can't easily check.

    0 讨论(0)
  • 2020-12-07 09:24

    Using Eclipe Oxygen command + Shift + c on macOSx Sierra will add/remove comments out multiple lines of code

    0 讨论(0)
  • 2020-12-07 09:26

    Eclipse Oxygen with CDT, PyDev:

    Block comments under Source menu

    Add Comment Block Ctrl + 4

    Add Single Comment Block Ctrl+Shift+4

    Remove Comment Block Ctrl + 5

    0 讨论(0)
  • 2020-12-07 09:29

    For Eclipse Editor

    For Single Line (Toggle Effect)

    Comment : Ctrl+Shift+c

    Uncomment: Ctrl+Shift+c

    For Multiple Lines (Toggle Effect) (Select the lines you want to comment)

    comment : Ctrl+Shift+c

    Uncomment: Ctrl+Shift+c

    It is for all html , css , jsp , java . It gives toggle effect.

    0 讨论(0)
提交回复
热议问题