Xtend Grey Space: It works great until it doesn't [message #1815746] |
Wed, 09 October 2019 17:44 |
Brandon Lewis Messages: 268 Registered: May 2012 |
Senior Member |
|
|
Seems nearly every time I use Xtend, I experience a brief moment of really liking the gray space capability followed by an extended period of cursing it's existence.
It almost always goes wrong for me at some point. Take this example, I'm doing standard coding indentation, which is supposed to be ignored, but it isn't. The editor is smart enough to tell me that I have problems, but not smart enough to fix them (like it says it's supposed to).
I'm generating a YAML output, so white space is critical to the storage format. if I can't get it right, I can't use it.
From this picture, why does Xtend and its editor hate me?
[Updated on: Wed, 09 October 2019 17:46] Report message to a moderator
|
|
|
|
|
|
Re: Xtend Grey Space: It works great until it doesn't [message #1815750 is a reply to message #1815749] |
Wed, 09 October 2019 18:29 |
Brandon Lewis Messages: 268 Registered: May 2012 |
Senior Member |
|
|
I would expect that the whitespace of "direction:" would be recognized after two spaces after its containing <<IF>> template statement. It, I believe, should recognize that the initial 2 whitespace characters are keeping my code spacing consistent, but after that, all entered whitespace should be recognized.
Instead, I can put 3000 whitespace characters in and it won't enter a single space in front of "direction:" in my output. And I can't massage it to insert any real output whitespace there.
Why does line 59 recognize it needs to start "real whitespace" 2 whitespaces within the <<IF>>, but line 61 never recognizes it?
[Updated on: Wed, 09 October 2019 18:31] Report message to a moderator
|
|
|
Re: Xtend Grey Space: It works great until it doesn't [message #1815751 is a reply to message #1815750] |
Wed, 09 October 2019 18:31 |
|
nooo i mean: i dont know where you want to indent and were not.
=> i cannot tell you how to change the stuff.
for the direction: its the indentation of the if that matters
e.g.
class A {
def static void main(String[] args) {
println('''
---
component:
vendor : x
library: x
name : x
version: x
«IF true»
model:
«IF true»
ports:
«FOR port : 1..5»
«IF port !== null»
- port: «port»
«IF true»
wire:
«IF true»
direction: bla
«ENDIF»
«ENDIF»
«ENDIF»
«ENDFOR»
«ENDIF»
«ENDIF»
''')
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
|
|
|
Re: Xtend Grey Space: It works great until it doesn't [message #1816631 is a reply to message #1816625] |
Fri, 01 November 2019 20:23 |
Brandon Lewis Messages: 268 Registered: May 2012 |
Senior Member |
|
|
Doesn't work for me if my first entry is a <<xtend_var>>. When I try to use an <<xtend_var>> it almost never works - well I should say it works sometimes initially, but will inevitably start failing somewhere in my generator.
I often, if printing simple reports, start lines with a single '.' once it starts "messing up" and then it'll snap into making sense. But in real life I never have a literal character I can just put on a front line for force it to recognize my whitespacing
I don't get it. I got confident with your answer, tried every possible permutation of indents of:
'''
<<IF>>
<<FOR>>
<<xtend_var>>
I could think of and it refuses to insert leading white space in my for loop, or my if loop.
Whatever it wants me to do, I'm seem to be incapable of figuring it out. It's a fist fight every time. Seems _so_ simple and it's really cool when it works, but it breaks for me every time I try to use it.
[Updated on: Fri, 01 November 2019 20:28] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04107 seconds