rubymine 注释掉 Rails 代码

发布于 2024-11-02 05:04:19 字数 154 浏览 0 评论 0原文

在 ruby​​mine 中,很容易用代码 -> 编写 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

守望孤独 2024-11-09 05:04:19

选择要注释掉的行,然后在 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 is CTRL+/

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.

小ぇ时光︴ 2024-11-09 05:04:19

Ruby 确实有多行注释,尽管它们使用相对奇怪的语法:

=begin
some text or code here
=end

请注意,=begin=end 分隔符都必须位于行的最开头,没有任何内容否则应该在同一行。

Ruby does have multiline comments, although they use a relatively strange syntax:

=begin
some text or code here
=end

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.

夜夜流光相皎洁 2024-11-09 05:04:19

要评论一些这样的想法,

=begin
  your code is commented out
  this line is also commented
=end

请选择行并按 ctrl+shift+/
对于评论,有些人会这样想

#your code is commented out
#this line is also commented

,选择行并按 ctrl+/

to comment some think like this

=begin
  your code is commented out
  this line is also commented
=end

select lines and press ctrl+shift+/
to comments some think like this

#your code is commented out
#this line is also commented

select lines and press ctrl+/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文