Preserve regions in arbitrary places in generated files

Is there a feature you'd like us to add? Post it here.

Preserve regions in arbitrary places in generated files

Postby mfreidge on Thu Feb 22, 2007 11:41 pm

As I undersood from Preserving Hand-Coded Modifications to Generated Code
you have to specify position of preserve region(s) first in template.

And only regions in positions, defined by template, will be preserved.
It means that if different generated files need manual insertions in different places, the template will need to have a lot of preserve-region placeholders in all possible places where manual modification could be required.

It will be good to add an abilty to specify preserve regions in arbitrary places in generated files, rather than in templates, and still preserve code after generation.

Unfortunately, I am not sure that it is possible at all. May be generator should check context around the preserve block and compare with the context in a new generated file. If the match is found, it will insert preserve region in a new file to the matched position. If match is not found, show warning and move the preserve region to the end of the file.
Searching for matched context should use algorithms similar to WinDiff.

Hopefully someone else can suggest better ideas how to implement this
Michael Freidgeim
Posts: 16
Joined: Tue Aug 01, 2006 3:21 am

Postby justin.greenwood on Sat Feb 24, 2007 3:28 pm

The next build will contain the functions: (the code is done - build will be released shortly)
Code: Select all
preserveWithDefault(key, defaultValue);
getPreserveBlockWithDefault(key, defaultValue);
User avatar
Site Admin
Posts: 441
Joined: Sat Apr 03, 2004 6:10 am
Location: Indianapolis, IN

Return to Enhancements

Who is online

Users browsing this forum: No registered users and 1 guest