【问题标题】:Is it possible to write comments in Xtend-templates?是否可以在 Xtend 模板中写评论?
【发布时间】:2015-07-06 11:17:09
【问题描述】:

是否可以在 Xtend 模板中编写 cmets? (例如为了快速注释掉一个 IF 语句或任何东西)

【问题讨论】:

    标签: templates xtend


    【解决方案1】:

    是的,这是可能的。在 Eclipse 中使用切换注释操作或手动输入前缀 «««,例如 ««« my comment in a template

    【讨论】:

      【解决方案2】:

      您可以将««« 用于像 Sebastian Zarnekow 提到的单行 cmets。 这种注释风格的一个缺点是它还会在这一行的末尾删除换行符。有时这正是您想要的,但有时并非如此。

      例如:下面的代码sn -p ...

      val x = '''
          line 1
          line 2 ««« my comment
          line 3
          line 4
      '''
      println(x)
      

      ... 将打印以下输出...

      line 1
      line 2  line 3
      line 4
      

      另一种注释方式是插入一个表达式,并在表达式 («») 中使用普通的旧 java 注释。 :«/* comment */»

      这样您就可以在同一行中继续使用模板,跨越多行并且避免删除的换行符。

      PS:你可以这样插入guillemets:

      • « 按住 ALT,然后在 num 块上按住 1 7 4
      • » 按住 ALT,然后在 num 块上按住 1 7 5
      • 或者您将一个好的组合键映射到您的 IDE 中的两个字符,例如CTRL+<CTRL+>

      【讨论】:

        【解决方案3】:

        xtend-templates 中的注释:【Ctrl + /】

        【讨论】:

          猜你喜欢
          • 2019-09-16
          • 2013-11-04
          • 2020-04-19
          • 2020-10-31
          • 2017-08-08
          • 2016-12-23
          • 2013-02-09
          • 1970-01-01
          相关资源
          最近更新 更多