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

Bug 333940

Summary: The rewrite infrastructure pretty-prints all code between the first and last change in every block
Product: [Tools] CDT Reporter: Fredrik Berg Kjolstad <fredrikbk>
Component: cdt-refactoringAssignee: Sergey Prigogin <eclipse.sprigogin>
Status: RESOLVED FIXED QA Contact: Emanuel Graf <emanuel>
Severity: normal    
Priority: P3 CC: cdtdoug, eclipse.sprigogin, kosashi, yevshif
Version: 8.0   
Target Milestone: 8.0.2   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 296192    

Description Fredrik Berg Kjolstad CLA 2011-01-10 23:09:51 EST
Build Identifier: M20100909-0800

The rewrite infrastructure scans each block that has been changed and finds the first and last edit in that block. It then inserts a pretty printing of the modified AST into the space between those edits. 

As a result, if a refactoring, for example inserts a statement at the beginning and end of a method all the code in the method between those statements, that was never actually touched by the refactoring, is pretty-printed. As a consequence the users code formatting is lost and macros expanded. This holds for any code block including that of a class.

Reproducible: Always

Steps to Reproduce:
1. Use the ASTRewrite class to insert a statement at the beginning and end of a method
2. Observe that the formatting of the code in the method is changed, and that macros are expanded.
Comment 1 Sergey Prigogin CLA 2011-11-07 18:34:13 EST
I believe this is fixed now. Please reopen if you can provide a an example that still reproduces this problem.