Bug 329843 - [templates][formatting] Code formatter with user defined profile does not modify templates
Summary: [templates][formatting] Code formatter with user defined profile does not mod...
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2010-11-09 13:45 EST by Guillaume Massé CLA
Modified: 2010-11-22 05:08 EST (History)
3 users (show)

See Also:


Attachments
My formatter user profile (28.69 KB, text/xml)
2010-11-09 13:47 EST, Guillaume Massé CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Massé CLA 2010-11-09 13:45:51 EST
Build Identifier: M20100909-0800

See my attached user define formater profile

Reproducible: Always

Steps to Reproduce:
1. Import my profile
Comment 1 Guillaume Massé CLA 2010-11-09 13:47:27 EST
Created attachment 182746 [details]
My formatter user profile
Comment 2 Guillaume Massé CLA 2010-11-10 10:18:47 EST
This is present in the 32 bit Carbon Version. It is ok in the 64 bit Cocoas.
Comment 3 Olivier Thomann CLA 2010-11-15 15:21:57 EST
(In reply to comment #2)
> This is present in the 32 bit Carbon Version. It is ok in the 64 bit Cocoas.
Could you please describe what is working in Carbon and not working in Cocoa?

JDT/Core code is the same in both cases. So this might be reported against a different component.
Comment 4 Guillaume Massé CLA 2010-11-15 15:47:36 EST
In 32 bit Carbon when I set up my code style, template wont follows it.

My template:
for( int i; i < size; i++ )
{

}

would display in the template menu and when I use it with code completion
for( int i; i < size; i++ ){

}

In 64 bit Cocoa when I set up my code style, template follows it

(In reply to comment #3)
> (In reply to comment #2)
> > This is present in the 32 bit Carbon Version. It is ok in the 64 bit Cocoas.
> Could you please describe what is working in Carbon and not working in Cocoa?
> 
> JDT/Core code is the same in both cases. So this might be reported against a
> different component.
Comment 5 Olivier Thomann CLA 2010-11-17 11:23:26 EST
Move to JDT/Text.
The JDT/Core code is identical in both cases.
Comment 6 Dani Megert CLA 2010-11-19 07:55:03 EST
I cannot reproduce this using 3.7 M3 with the existing for templates or a user defined one like:
--------- %< ---------
for( int i; i < size; i++ )
{

}
--------- %< ---------

If you still see this please
1. provide the template that you use (best is to export them and attach them
   here
2. explain what you mean exactly by "the template menu"
Comment 7 Guillaume Massé CLA 2010-11-19 08:48:32 EST
(In reply to comment #6)
> I cannot reproduce this using 3.7 M3 with the existing for templates or a user
> defined one like:
> --------- %< ---------
> for( int i; i < size; i++ )
> {
> 
> }
> --------- %< ---------
> 
> If you still see this please
> 1. provide the template that you use (best is to export them and attach them
>    here
> 2. explain what you mean exactly by "the template menu"

1. Check the attachment on top of the post ( My formatter user profile )
( right click to downloads, it's seems there is a bug with bugzilla... ).

2. Eclipse --> Preferences --> Java --> Editor --> Templates
Preview window will shows:

for (int ${index} = 0; ${index} < ${array}.length; ${index}++) {
	${line_selection}${cursor}
}

while Eclipse --> Preferences --> Java --> Code Style --> Formatter --> Edit..
Preview window will shows:
for ( int i = 0, j = array.length; i < array.length; i++, j-- )
{
}

This is a bug for both eclipse carbon 32bit and cocoa 64bit. [ Part1 ]

The difference is that code completion on carbon 32bit will put the wrong format of Templates preview while cocoa 64 bits will put the right format of Formatter preview view. [ Part 2 ]

I hope this clarify the situation. Marked as reopen. Since part 1 of the bug affect the newest version ( eclipse cocoa 64bit. You might want to verify Part 1 in other OS as well.
Comment 8 Guillaume Massé CLA 2010-11-19 08:50:34 EST
(In reply to comment #7)

> I hope this clarify the situation. Marked as reopen. Since part 1 of the bug
> affect the newest version ( eclipse cocoa 64bit. You might want to verify Part
> 1 in other OS as well.

Ops:
Since part 1 of the bug affect the newest version ( eclipse cocoa 64bit ) I marked this bug reopen.
Comment 9 Dani Megert CLA 2010-11-19 09:06:19 EST
You didn't mention the preview in comment 0. This is bug 8080 which we don't plan to fix.

>The difference is that code completion on carbon 32bit will put the wrong
>format of Templates preview while cocoa 64 bits will put the right format of
>Formatter preview view. [ Part 2 ]
Can you attach a screenshot for both versions? Also, did you modify the template or is it the default 'for' template?

Is the inserted code correct?
Comment 10 Guillaume Massé CLA 2010-11-19 10:36:23 EST
(In reply to comment #9)
> You didn't mention the preview in comment 0. This is bug 8080 which we don't
> plan to fix.

There is a checkbox use code formatter. If nobody plan to implement that checkbook then it should be remove. This button is doing nothing since 2002.

> 
> >The difference is that code completion on carbon 32bit will put the wrong
> >format of Templates preview while cocoa 64 bits will put the right format of
> >Formatter preview view. [ Part 2 ]
> Can you attach a screenshot for both versions?

Why ? It's text...
please see comment #4

> Also, did you modify the
> template or is it the default 'for' template?

No

> Is the inserted code correct?

No
Comment 11 Dani Megert CLA 2010-11-19 10:56:18 EST
(In reply to comment #10)
> (In reply to comment #9)
> > You didn't mention the preview in comment 0. This is bug 8080 which we don't
> > plan to fix.
> 
> There is a checkbox use code formatter. If nobody plan to implement that
> checkbook then it should be remove. This button is doing nothing since 2002.
It's applied when you *insert* the template and in the code assist preview as you have already seen.

> > Is the inserted code correct?
> No
OK, that's not good. Currently I have no clue because the code is not OS dependent.

Markus, please try this out on Carbon 32bit. Thanks.
Comment 12 Markus Keller CLA 2010-11-22 05:08:03 EST
(In reply to comment #11)
> > > Is the inserted code correct?
> > No
> 
> Markus, please try this out on Carbon 32bit. Thanks.

Works fine for me with 3.7M3 Carbon 32bit (32bit processor, latest JavaSE 6).

If you can still reproduce with that version (or a later one), please start with a new workspace, set everything up to reproduce the problem. Then close Eclipse, zip the workspace, and attach it here.