Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331978

Summary: [engine] Bad indentation with protected area
Product: [Modeling] Acceleo Reporter: Stephane Begaudeau <stephane.begaudeau>
Component: CoreAssignee: Project Inbox <acceleo-inbox>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P2 CC: junk, laurent.goubet, sebastien.latre, william.piers
Version: 3.0.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Stephane Begaudeau CLA 2010-12-07 01:54:26 EST
If we generate a protected area with for example a tabulation. Each time we will regenerate the file, the content of the protected area will be pushed further.
Comment 1 Glenview Jeff CLA 2010-12-16 12:22:59 EST
Stephane:

Would you mind bumping up the importance of this bug?  It's a painful bug and messes up the versioning.  

Thanks!
Jeff
Comment 2 Laurent Goubet CLA 2010-12-16 13:26:26 EST
Jeff,

bugs will be fixed in one release or the next, we can't give you any estimates. If one or more users vote on this bug, we'll likely raise its priority, but it isn't one for now.

In short, you can influence this in three ways :
 - vote on this bug an pray that other users will too.
 - tackle the bug yourself and provide us with a patch fixing the issue.
 - buy commercial support from either Obeo (http://obeo.fr/pages/maintenance-and-support/en) or any other company that would propose maintenance support for Acceleo

Of course, you can also wait for us to fix this bug, but you'll have to wait till we no longer have any bug more serious that this one.
Comment 3 Glenview Jeff CLA 2010-12-16 14:40:43 EST
(In reply to comment #2)
> Jeff,
> 
> bugs will be fixed in one release or the next, we can't give you any estimates.
> If one or more users vote on this bug, we'll likely raise its priority, but it
> isn't one for now.
> 
> In short, you can influence this in three ways :
>  - vote on this bug an pray that other users will too.
>  - tackle the bug yourself and provide us with a patch fixing the issue.
>  - buy commercial support from either Obeo
> (http://obeo.fr/pages/maintenance-and-support/en) or any other company that
> would propose maintenance support for Acceleo
> 
> Of course, you can also wait for us to fix this bug, but you'll have to wait
> till we no longer have any bug more serious that this one.

Hi Laurent:

It appears that voting isn't enabled for Acceleo.  According to the voting help, there should be a voting button to the right of the importance field.  There isn't such a button in my views.  Am I missing something?

Thanks,
Jeff
Comment 4 Laurent Goubet CLA 2010-12-17 03:34:09 EST
I just realized that voting is configured "per project" on the Eclipse bugzilla instead of being enabled by default ... I opened bug 332822 so that voting can be enabled on M2T/Acceleo
Comment 5 William Piers CLA 2010-12-22 05:20:11 EST
bug 332822 is closed, but I can't see any voting button yet. 
Anyway, the bug is still present in the latest 3.1M4 build.
I vote to bump up the importance of this bug: when using EEF it is painful to synchronize blank changes with the repository after each regeneration.
Comment 6 Laurent Goubet CLA 2010-12-22 09:32:37 EST
This is fixed in both HEAD and 3.0.2. It will be available in the upcoming builds.
Comment 7 Stephane Begaudeau CLA 2011-02-17 04:55:42 EST
I am reopening this bug since it is not completely fixed. If you have an expression that calls a template like this:

<tabulation>[myTemplateCall()/]

and if in your template there is a protected area:

[template public myTemplateCall()]
[protected ('id')]
protected content
[/protected]
[/template]

then the two following lines will still get "pushed" after each new generation:
protected content
[/protected]

because of the tabulation before the template call.
Comment 8 Sébastien Latre CLA 2011-04-27 09:50:18 EDT
(In reply to comment #7)
> I am reopening this bug since it is not completely fixed. If you have an
> expression that calls a template like this:
> 
> <tabulation>[myTemplateCall()/]
> 
> and if in your template there is a protected area:
> 
> [template public myTemplateCall()]
> [protected ('id')]
> protected content
> [/protected]
> [/template]
> 
> then the two following lines will still get "pushed" after each new generation:
> protected content
> [/protected]
> 
> because of the tabulation before the template call.

I don't reproduce this bug when the call to the template is directly done in a [file] block but reproduced in a second level

[file ('test331978.txt')]
[level1()/]
[/file]

[template public level1() ]
[for (name : String | Sequence{'a','b'})]
	[protected (': Before component '+name)]
	[/protected]
	[level2(name)/]
[/for]
	[level2('c')/]
[level2('d')/]
[/template]

[template public level2(name : String)]
[protected (': In component '+name)]
[/protected]
[/template]


The first time, the result is ok:
Start of user code : Before component a
End of user code
	Start of user code : In component a
	End of user code
Start of user code : Before component b
End of user code
	Start of user code : In component b
	End of user code
	Start of user code : In component c
	End of user code
Start of user code : In component d
End of user code

The second time, a gap appears in the end of protected area:
Start of user code : Before component a
End of user code
	Start of user code : In component a
		End of user code
Start of user code : Before component b
End of user code
	Start of user code : In component b
		End of user code
	Start of user code : In component c
		End of user code
Start of user code : In component d
End of user code
Comment 9 Stephane Begaudeau CLA 2011-05-05 09:01:51 EDT
A new fix has been contributed on HEAD, it will be available in Acceleo 3.1.0 RC1.
It solved all the problems on *my* examples but since the possibilities that would require testing are virtually unlimited I won't close this issue for now. 

For those who want to give it a try, the fix is available starting with the build 168: https://hudson.eclipse.org/hudson/view/Modeling/job/m2t-acceleo-3.1/168/

This build and the builds available on hudson are nightly build and as such you should not install them on a production environment.
Comment 10 Stephane Begaudeau CLA 2011-06-24 08:50:24 EDT
Closing once again this entry since the new algorithm seems to have fixed the issue.
Comment 11 Laurent Goubet CLA 2011-08-18 04:21:59 EDT
Closing our "resolved" and "verified" bugs.