rubymine 注释掉 Rails 代码
在 rubymine 中,很容易用代码 -> 编写 html 代码行注释,但是如何在 ruby 中注释多行。
%= "this is a test %>
到
#= "this is a test %>
in rubymine it is easy to code out html with code -> line comment, but how do you comment multiple lines in ruby.
%= "this is a test %>
to
#= "this is a test %>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
选择要注释掉的行,然后在 Mac 上执行
CMD+/
(正斜杠)。在 PC 上,我假设同样的事情是CTRL+/
您可以以相同的方式取消注释,也可以使用相同的按键注释单行。光标位于行的哪个位置并不重要。只要选择了该行的一部分,注释就会包含整行。
Select the lines you want to comment out, and do
CMD+/
(forward slash) on a Mac. On a PC I'm assuming the same thing isCTRL+/
You can un-comment the same way, and you can also comment single lines out with the same keystroke. It doesn't really matter where your cursor is on the line. As long as a part of the line has been selected, the comment will include the whole line.
Ruby 确实有多行注释,尽管它们使用相对奇怪的语法:
请注意,
=begin
和=end
分隔符都必须位于行的最开头,没有任何内容否则应该在同一行。Ruby does have multiline comments, although they use a relatively strange syntax:
Note that both the
=begin
and=end
delimiters have to be at the very beginning of the line, nothing else should be on the same line.要评论一些这样的想法,
请选择行并按 ctrl+shift+/
对于评论,有些人会这样想
,选择行并按 ctrl+/
to comment some think like this
select lines and press ctrl+shift+/
to comments some think like this
select lines and press ctrl+/