wmyywm / eclipse-code-formatter-intellij-plugin

Automatically exported from code.google.com/p/eclipse-code-formatter-intellij-plugin
0 stars 0 forks source link

Javascript formatting is somehow different #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Apply the formatter on Eclipse
2. Point Eclipse Code Formatter to that file

Instead of being exactly the same, somehow the formatting is different. I 
attached the org.eclipse.wst.jsdt.core.prefs file that I used so one can 
compare between both. It seems it breaks the formatting when an array is 
present.

What version of the product are you using? 
IntelliJ 11.0.2

On what operating system?
Windows 7

Original issue reported on code.google.com by rafael.s...@gmail.com on 29 Feb 2012 at 4:38

Attachments:

GoogleCodeExporter commented 9 years ago
what exactly is the problem? 
I created new eclipse project, set the project specific settings, copied your 
preference file, restarted  (but refresh seems enough), formatted. 
Then I setted the preference file in Intellij, formatted and the result was the 
same as in Eclipse.

Original comment by vojta.kr...@gmail.com on 29 Feb 2012 at 8:18

GoogleCodeExporter commented 9 years ago
to be exact, formatting both in intellij and eclipse was the same as 
intellijformatting.txt 

Original comment by vojta.kr...@gmail.com on 29 Feb 2012 at 8:39

GoogleCodeExporter commented 9 years ago
Now I understand what the problem is. It seems IntelliJ is smarter than 
Eclipse, because if I use your plugin and I open an external file it still 
applies the formatting settings, which is good. With Eclipse, if you do the 
same, he doesn't apply the formatting settings, because it's project related 
and since you're opening an external file, he will not apply the settings.

Thanks and apologies for the time sent.

It's a great plugin you developed, thank you so much! 

Original comment by rafael.s...@gmail.com on 1 Mar 2012 at 9:01

GoogleCodeExporter commented 9 years ago
ok :-)

if you would be so kind, you can write a comment and rate this plugin with 5 
stars at  http://plugins.intellij.net/plugin/?idea&id=6546   

Original comment by vojta.kr...@gmail.com on 1 Mar 2012 at 9:17

GoogleCodeExporter commented 9 years ago
Done, thanks again!

Original comment by rafael.s...@gmail.com on 1 Mar 2012 at 10:50

GoogleCodeExporter commented 9 years ago
Thank you! 

Original comment by vojta.kr...@gmail.com on 1 Mar 2012 at 10:52

GoogleCodeExporter commented 9 years ago
Just one more question though, it seems that in IntelliJ when you format using 
your plugin he doesn't wrap comments as in Eclipse. For example:

Eclipse:

/**
 * Plugin used to check the component has at least one of the permissions provided.
 * 
 * Usage:
 * 
 * This checks only for one permission
 * 
 * var button = new Ext.Button({ plugins: new Abc.security.AnyGranted('PERM_LOGIN') });
 * 
 * This checks only for all permissions
 * 
 * var button = new Ext.Button({ plugins: new Abc.security.AnyGranted(['PERM_LOGIN','PERM_DASHBOARD']) });
 * 
 * 
 */

IntelliJ
/**
 * Plugin used to check the component has at least one of the permissions provided.
 *
 * Usage:
 *
 * This checks only for one permission
 *
 * var button = new Ext.Button({
 *      plugins: new Abc.security.AnyGranted('PERM_LOGIN')
 * });
 *
 * This checks only for all permissions
 *
 * var button = new Ext.Button({
 *      plugins: new Abc.security.AnyGranted(['PERM_LOGIN','PERM_DASHBOARD'])
 * });
 *
 *
 */

Original comment by rafael.s...@gmail.com on 1 Mar 2012 at 11:12

GoogleCodeExporter commented 9 years ago
my eclipse makes this from it...
    /**
     * Plugin used to check the component has at least one of the permissions provided. Usage: This checks only for one permission var button = new
     * Ext.Button({ plugins: new Abc.security.AnyGranted('PERM_LOGIN') }); This checks only for all permissions var button = new Ext.Button({ plugins:
     * new Abc.security.AnyGranted(['PERM_LOGIN','PERM_DASHBOARD']) });
     */

i think it is not function of formatter, but some Clean Up... it may be 
possible to migrate too. 

Original comment by vojta.kr...@gmail.com on 1 Mar 2012 at 11:22

GoogleCodeExporter commented 9 years ago
hmm so it has to do something with the formatter... problem is that eclipse 
function which i call to format is so stupid, that it does not format 
everything... so i would need to find comments and call formatting on these 
manually...

Original comment by vojta.kr...@gmail.com on 1 Mar 2012 at 11:36

GoogleCodeExporter commented 9 years ago
I found it. It seems your plugin is not checking the comments tab in the 
eclipse settings.

If I remove the 3 first checkboxes that I show in the screenshot then comment 
formatting is disabled in eclipse as well, but I wanted to use it in IntelliJ. 
It seems IntelliJ ignores those 3 checkboxes when formatting with your plugin.

Original comment by rafael.s...@gmail.com on 1 Mar 2012 at 3:27

Attachments:

GoogleCodeExporter commented 9 years ago
Here are the div lines between the two org.eclipse.wst.jsdt.core.prefs

org.eclipse.wst.jsdt.core.formatter.comment.format_block_comments=false
org.eclipse.wst.jsdt.core.formatter.comment.format_javadoc_comments=false
org.eclipse.wst.jsdt.core.formatter.comment.format_line_comments=false

It seems your plugin is not considering these 3 settings

Original comment by rafael.s...@gmail.com on 1 Mar 2012 at 3:36

GoogleCodeExporter commented 9 years ago
i will need to download eclipse sources. there is probably needed a lot more 
logic than just sending a file into formatter.

Original comment by vojta.kr...@gmail.com on 1 Mar 2012 at 3:40

GoogleCodeExporter commented 9 years ago

Original comment by vojta.kr...@gmail.com on 1 Mar 2012 at 3:42

GoogleCodeExporter commented 9 years ago
eclipse code is a mess, there is no easy way how to reuse it. 

I will need some parser(written in java or groovy) for finding comments in the 
code, and those will be formatted separatelly...

Original comment by vojta.kr...@gmail.com on 1 Mar 2012 at 7:48

GoogleCodeExporter commented 9 years ago
No worries, I'll disable comments in Eclipse and then both projects are 
synchronized.

Original comment by rafael.s...@gmail.com on 1 Mar 2012 at 7:50

GoogleCodeExporter commented 9 years ago
it wont be so hard.
i have nothing better to do anyway ;)

Original comment by vojta.kr...@gmail.com on 1 Mar 2012 at 7:54

GoogleCodeExporter commented 9 years ago
Wanna work for my company? ;)

Original comment by rafael.s...@gmail.com on 1 Mar 2012 at 7:56

GoogleCodeExporter commented 9 years ago
haha, no :-)

Original comment by vojta.kr...@gmail.com on 1 Mar 2012 at 8:07

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by vojta.kr...@gmail.com on 26 Mar 2012 at 3:12

GoogleCodeExporter commented 9 years ago

Original comment by vojta.kr...@gmail.com on 5 Apr 2012 at 12:47

GoogleCodeExporter commented 9 years ago
fixed in 2.5, disabled by default.

but there may be other cases in which it will not work.

Original comment by vojta.kr...@gmail.com on 28 Aug 2012 at 5:05