| Summary: | The refactoring infrastructure does not adhere to user set indentation rules | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Fredrik Berg Kjolstad <fredrikbk> |
| Component: | cdt-refactoring | Assignee: | Sergey Prigogin <eclipse.sprigogin> |
| Status: | RESOLVED FIXED | QA Contact: | Emanuel Graf <emanuel> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, eclipse.sprigogin, malaperle, yevshif |
| Version: | 8.0 | ||
| Target Milestone: | 8.0.2 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 296192 | ||
| Attachments: | |||
|
Description
Fredrik Berg Kjolstad
Created attachment 186458 [details]
Bugfix that makes the refactoring infrastructure insert new code with user workspace indentation settings instead of four spaces
Patch that changes the indentation of inserted/replaced statements to the user-specified settings (tab/space/mixed and number of spaces).
Comment by Emanuel Graf in original bug: (In reply to comment #7) > Created an attachment (id=184307) [details] > Patch that changes fixed four space statement indentation to user settings You use the workspace settings better use the project specific settings if available. Created attachment 186459 [details]
Bugfix: First attempt at a patch to set indentation width based on project settings if available
This patch is a first attempt at a way to use project indentation settings, if available, to govern refactoring rewriting. The solution passes an option map down to the Scribe class and is not the cleanest, but the project seems only to be available at the higher levels. Specifically I found no way to retrieve a project if I have an AST node.
I welcome alternate approaches. If not, then this might be good enough.
Attachment 186458 [details]: The class CCodeFormatter already has functionality to generate properly formatted indent strings, given project/workspace options, and should be used instead of the custom indent code. Attachment 186459 [details]: A CCodeFormatter should be passed down instead of the ugly and verbose options Map. Lastly, should look into how JDT handles this so as to avoid passing unnecessary state around. *** Bug 347495 has been marked as a duplicate of this bug. *** Fixed in cdt_8_0 and master. |