Is it possible to write comments in Xtend-templates?
Asked Answered
D

3

5

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

Drudge answered 6/7, 2015 at 11:17 Comment(0)
D
6

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

Deedee answered 6/7, 2015 at 11:55 Comment(0)
S
1

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+>
Suppositious answered 31/10, 2018 at 21:2 Comment(0)
J
0

comment in xtend-templates: 【Ctrl + /】

Jardine answered 27/3, 2020 at 9:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.