Eclipse comment/uncomment shortcut?

前端 未结 17 1167
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 16:23

I thought this would be easy to achieve, but so far I haven\'t found solutions for comment/uncomment shortcut on both Java class editor and jsf faceted we

相关标签:
17条回答
  • 2020-11-30 16:43

    For a Mac it is the following combination: Cmd + /

    0 讨论(0)
  • 2020-11-30 16:47

    Ctrl + Shift + C . Works great on .java, .xhtml, .properties and maybe on others but I only tested these ones. Can comment single or multiple lines.

    0 讨论(0)
  • 2020-11-30 16:48

    Ctrl + 7 to comment a selected text.

    0 讨论(0)
  • 2020-11-30 16:48

    For those who like to customize things (and screw them up), some tips:

    In "Preferences" - "General" - "Keys", type "comment" to get a full list of comment key combination in all editors. Be sure only to edit, not copy commands(because you cannot erase created ones).

    For HTML files, look for those with scope "Editing HTML files". The names are confusing, yes, but the description shows more or less when each and every key is used.

    At last, I am only able to define block comment in HTML here. It works for both HTML code and Javascript code(add at the beginning and the end, <!-- and --> if is HTML, and add /* and */ if is Javascript). (I remember once there may be a "line comment" key (add comments for every line) but now it is not there anymore. If someone knows how to find it and tell me, I will be very grateful.) The category must be Edit. Source does not work.

    EDIT:

    I found how to configure XML Toggle comment! The category should be Edit, too. Then you can toggle comment in **XML Editor(the one with "Design" and "Source" tabs).

    0 讨论(0)
  • 2020-11-30 16:49

    Comments In Java class


    1. Toggle/Single line Comment ( Ctrl+/ ) - Add/remove line comments (//…) from the current line.
    2. Add Block Comment ( Ctrl+Shift+\ ) - Wrap the selected lines in a block comment (/*… */).
    3. Remove Block Comment ( Ctrl+Shift+/ ) - Remove a block comment (/*… */) surrounding the selected lines.
    4. Add Javadoc Comment ( Alt+Shift+J ) - Add a Javadoc comment to the active field/method/class.

    Comments In HTML/XML/Config file


    1. Add Block Comment ( Ctrl+Shift+/ ) - Wrap the selected lines in a block comment (< !-- -->).
    2. Remove Block Comment (Ctrl+Shift+\) - Remove a block comment (< !-- -->) surrounding the selected lines.
    0 讨论(0)
  • 2020-11-30 16:50

    In eclipse Pressing Ctrl + Shift + L, will list all the shortcuts.

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