Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to write comments in Xtend-templates?

Is it possible to write comments inside an Xtend template? (for example in order to quickly comment out an IF-statement or anything)

like image 618
cwde Avatar asked Jul 06 '15 11:07

cwde


2 Answers

Yes, that's possible. Use the toggle-comment action in Eclipse or type the prefix ««« manually, e.g as in ««« my comment in a template

like image 161
Sebastian Zarnekow Avatar answered Sep 20 '22 14:09

Sebastian Zarnekow


You can use ««« for single line comments like Sebastian Zarnekow mentioned. A drawback of this commenting style is that it also comments out the newline character at the end of this line. Sometimes that's exactly what you want, but sometimes it's not.

For example: The following code snippet ...

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

... will print following output ...

line 1
line 2  line 3
line 4

Another way to comment is as if you would insert an expression and inside the expression («») you use a plain old java comment. : «/* comment */»

That way you can go on with you template in the same line, span multiple rows and you avoid the deleted newline character.

PS: You can insert the guillemets this way:

  • « with ALT holding down and then 1 7 4 on the num block
  • » with ALT holding down and then 1 7 5 on the num block
  • or you map a good key combination to the two chars in your IDE, e.g. CTRL+< and CTRL+>
like image 35
armin.miedl Avatar answered Sep 16 '22 14:09

armin.miedl