Eclipse shortcut for commenting jsp, xml code

前端 未结 5 1744
情歌与酒
情歌与酒 2020-12-14 00:01

In IDEA, we can comment/uncomment lines in java as well as html,jsp, xml files with the same keyboard shortcut combination. I tried doing that in eclipse but was not able to

相关标签:
5条回答
  • 2020-12-14 00:06

    In Mac, for xml:

    Command+/ - To comment a line or selected block of lines

    Command+\ - To uncomment a line or selected block of lines

    This works in Eclipse Photon (4.8.0)

    0 讨论(0)
  • 2020-12-14 00:13

    I believe CTRL+SHIFT+C works in XML, not sure about JSP. I think it lacks consistency in the various editors, and some don't have this shortcut.

    0 讨论(0)
  • 2020-12-14 00:14

    In eclipse they use same kind of shortcut to do this which is for:

    I found Ctrl + Shift + C works in XML and JSP.

    Single line

    comment Ctrl + /

    uncomment Ctrl + /

    Multiline

    comment Ctrl + Shift + /

    uncomment Ctrl + Shift + \ (note the backslash)

    Hope this helps!

    0 讨论(0)
  • 2020-12-14 00:19

    I found Ctrl + Shift + C works in JSP too, it works like:

    <tiles:insertDefinition name="" >
    </tiles:insertDefinition>
    
    <!--<tiles:insertDefinition name="" >-->
    <!--</tiles:insertDefinition>-->
    

    add comment tag line by line, and select the sentences, use Ctrl + Shift + C again can toggle remove the comments.

    Ctrl + Shift + / add block comment in JSP, works like:

    <tiles:insertDefinition name="" >
    </tiles:insertDefinition>
    
    <!--<tiles:insertDefinition name="" >
        </tiles:insertDefinition>                       
    -->
    

    can use Ctrl + Shift + \ to remove the block comment.

    PS: I want to find out, which eclipse shortcut can add/remove <%-- --%> comment in JSP?

    0 讨论(0)
  • 2020-12-14 00:27

    I use Shift+Ctrl+/ to Add Block Comment in both XML and JSP files (works at the line level or for a selected block).

    Just in case, if you are looking for a particular shortcut, you can use Shift+Ctrl+L to Show Key Assist (i.e. the Commands and their Bindings).

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