Eclipse 注释jsp、xml代码的快捷方式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2211454/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse shortcut for commenting jsp, xml code
提问by Thunderhashy
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 comment out lines in html,jsp and xml files. Is there a way to do it in Eclipse? Also I would like to know whether bulk comment is also available for non-java files.
在 IDEA 中,我们可以使用相同的键盘快捷键组合在 java 以及 html、jsp、xml 文件中注释/取消注释行。我尝试在 eclipse 中这样做,但无法注释掉 html、jsp 和 xml 文件中的行。有没有办法在 Eclipse 中做到这一点?另外我想知道批量评论是否也适用于非java文件。
回答by Pascal Thivent
I use Shift+Ctrl+/to Add Block Commentin both XML and JSP files (works at the line level or for a selected block).
我用Shift+ Ctrl+/来添加块注释在XML和JSP文件(在线路电平或选定块的工作)。
Just in case, if you are looking for a particular shortcut, you can use Shift+Ctrl+Lto Show Key Assist(i.e. the Commands and their Bindings).
为了以防万一,如果你正在寻找一个特定的快捷方式,可以使用Shift+ Ctrl+ L,以显示键辅助(即命令及其绑定)。
回答by harschware
I believe CTRL+SHIFT+Cworks in XML, not sure about JSP. I think it lacks consistency in the various editors, and some don't have this shortcut.
我相信CTRL+ SHIFT+C的XML的作品,不知道JSP。我认为它在各种编辑器中缺乏一致性,有些没有这个快捷方式。
回答by yuting_lv
I found Ctrl+ Shift+ Cworks in JSP too, it works like:
我发现Ctrl+ Shift+ CJSP中的作品也一样,它的工作原理是:
<tiles:insertDefinition name="" >
</tiles:insertDefinition>
<!--<tiles:insertDefinition name="" >-->
<!--</tiles:insertDefinition>-->
add comment tag line by line, and select the sentences, use Ctrl+ Shift+ Cagain can toggle remove the comments.
通过行添加注释标记线,并选择语句,使用Ctrl+ Shift+C又可以切换删除评论。
Ctrl+ Shift+ /add block comment in JSP, works like:
Ctrl+ Shift+/在 JSP 中添加块注释,工作方式如下:
<tiles:insertDefinition name="" >
</tiles:insertDefinition>
<!--<tiles:insertDefinition name="" >
</tiles:insertDefinition>
-->
can use Ctrl+ Shift+ \to remove the block comment.
可以使用Ctrl+ Shift+\删除块注释。
PS: I want to find out, which eclipse shortcut can add/remove <%-- --%>
comment in JSP?
PS:我想知道,哪个eclipse快捷方式可以<%-- --%>
在JSP中添加/删除注释?
回答by tk_
In eclipse they use same kind of shortcut to do this which is for:
在 Eclipse 中,他们使用相同类型的快捷方式来执行此操作,用于:
I found Ctrl+ Shift+ Cworks in XML and JSP.
我发现Ctrl+ Shift+ CXML和JSP的作品。
Single line
单线
commentCtrl+ /
评论Ctrl+/
uncommentCtrl+ /
取消注释Ctrl+/
Multiline
多线
commentCtrl+ Shift+ /
评论Ctrl+ Shift+/
uncommentCtrl+ Shift+ \(note the backslash)
取消注释Ctrl+ Shift+ \(注意反斜杠)
Hope this helps!
希望这可以帮助!
回答by Omkar
In Mac, for xml:
在 Mac 中,对于 xml:
Command+/- To comment a line or selected block of lines
Command+ /- 注释一行或选定的行块
Command+\- To uncomment a line or selected block of lines
Command+ \- 取消注释一行或选定的行块
This works in Eclipse Photon (4.8.0)
这适用于 Eclipse Photon (4.8.0)