Community
Participate
Working Groups
Created attachment 240442 [details] Whitespace in front -> bad looking indentation The preview popup for the code shows the code with some bad looking indentation in some cases. The indentation in the preview popup seems to depend on the amount of whitespace in the currently selected line. If there is no whitespace at the start, the preview looks great. If there is some whitespace in front, the preview gets indented. I have attached two screenshots that show the problem. The indentation isn't really wrong though. The preview popup shows exactly what is inserted and the indentation has to be inserted for the snippet to be formatted correctly. The issue is just that the preview popup shouldn't display the indentation.
Created attachment 240443 [details] No whitespace in front -> good looking preview
Change in Gerrit: <https://git.eclipse.org/r/#/c/26216/>
Fix merged.
Created attachment 243347 [details] Somtimes wrong indentation
The fix seems not to work in all cases. E.g. the snippet GridLayout has a wrong indentation(see attachment)
For the record, the GridLayout template is correctly indented by Content Assist so apparently we don't mimic its behavior completely yet.
(In reply to Andreas Sewe from comment #6) > For the record, the GridLayout template is correctly indented by Content > Assist so apparently we don't mimic its behavior completely yet. The problem is "caused" by the comment (name + description) we add to the beginning of the snippet's preview. If you add the same leading comment to a JDT template, the Template Proposals Content Assist also indents incorrectly in its preview popup (now Bug 436490).
Fix in Gerrit: <https://git.eclipse.org/r/27909>. (Fixes only our indentation logic, not JDT's.)
The fix is merged. This does NOT fix JDT Bug 436490 but works around that issue by not indenting our snippet description comment which is only shown in the preview.
Closing for 2.1