Liam Newman remember in the eyes of users a Declarative Jenkinsfile is not a "script" and a shebang would be drawing attention to its groovy origins (we've spent a lot of time removing the stink of groovy from declarative).
If you've added a shebang, I can see how we might want to preserve that for you. Ill let Andrew Bayer make that call (the roundtrip is actually controlled by declarative itself - not the editor).
So we could always output a shebang at the top of the Jenkinsfile, but we can't only do it if there already was one - as with JENKINS-43005, that would need information that just isn't available to us in the parser.
I just know Andrew Bayer its going to write the worlds second groovy compliant AST parser any day now....
But seriously, a big she-bang is going to hint at people that this is actually groovy under the hood and its taken a lot of work to wash that stank off.
I just know [~abayer] its going to write the worlds second groovy compliant AST parser any day now.... ;)
But seriously, a big she-bang is going to hint at people that this is actually groovy under the hood and its taken a lot of work to wash that stank off.
Andrew, maybe it would be good to have another ticket describing the need for "preservation of comments" that has a good description on why this is hard and not feasible to do in the short term. Whenever the shebang or comment preservation comes up, you can close it as a duplicate of that ticket. I've done this for JENKINS-38442 and its a proven way of keeping the noise of endless explanations down and lays out quite clearly that people shouldn't hold their breath for this functionality.
James Dumay - such a ticket exists - JENKINS-38864. =) Liam Newman - Yeah, losing the license headers is a shame, but again...limitations of the tooling we have available to work with, and questions of how much value we'd actually get from the amount of research and work needed to be able to deliver.