You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Eclipse plugin produces different result as standalone formatter version #119
I'm testing the plugin, by installing it and selecting the google-java-formatter: [1].
Trying it on this file in Gerrit Code Review, produces completely different result, as release
version 1.2 of google java-formatter: [2]. What I was doing, is Ctrl-A followed by Ctrl+Shift+F.
Upgrade to Eclipse 4.6.2 didn't help either. Ctrl-Shift-F, without preceding Ctrl-A doesn't format with gjf.
I have an impression, that gjf only works in the Preferences->Java-Code Style=>Formatter, but not in the editor.
So I went ahead, and broke the plugin code with this diff, to confirm my impression: [1]. After building new version and deploying this plugin, I only get exception in the Eclipse log windows, when I enter the setting dialog for Formatter: [2]. However, when I left the Formatter setting dialog ang go back to my file, and press Ctrl+Shift+F I do not get the exception in opened log windows. That confirms that outside the Formatter settings, the plugin still doesn't have any effect.
Can you please prepend -debug and -consolelog in eclipse.ini? Maybe then you see a swallowed exception when you close the Preferences->Java-Code Style=>Formatter window. Or when pressing Ctrl-Shift-F.
Activity
sormuras commentedon Feb 9, 2017
Just guessing, the max line length is set to 80 and somehow that setting is applied to the formatted source.
sormuras commentedon Feb 9, 2017
And/or Gerrit Code Review does not honor the custom formatter implementation.
What happens, if you open
ChangeEditIT.javain an editor and press justCtrl+Shift+F?cushon commentedon Feb 9, 2017
That output wasn't produced by google-java-format. It looks like the built-in eclipse formatter.
The plugin worked for me with 4.6.2.
davido commentedon Feb 9, 2017
What do you mean exactly here? It's just a workspace that I opened in Eclipse and replaced the formatter.
I can try it later today.
Can it be some issues in my workspace then? Of course the next attempt is to upgrade my Eclipse to 4.6.2.
How can I track it down, whether the gjf is used from within the plugin or not?
davido commentedon Feb 9, 2017
Upgrade to Eclipse 4.6.2 didn't help either.
Ctrl-Shift-F, without precedingCtrl-Adoesn't format with gjf.I have an impression, that gjf only works in the Preferences->Java-Code Style=>Formatter, but not in the editor.
So I went ahead, and broke the plugin code with this diff, to confirm my impression: [1]. After building new version and deploying this plugin, I only get exception in the Eclipse log windows, when I enter the setting dialog for Formatter: [2]. However, when I left the Formatter setting dialog ang go back to my file, and press Ctrl+Shift+F I do not get the exception in opened log windows. That confirms that outside the Formatter settings, the plugin still doesn't have any effect.
My environment:
I created fresh workspace, open gerrit, opened a file and pressed
Ctrl-Shift-F.sormuras commentedon Feb 9, 2017
Hm, platform-dependent ... Eclipse bug? Did test on Windows.
Did you try w/oYou did. Mh. Running out of clues here.Ctrl+Atoo?sormuras commentedon Feb 9, 2017
Can you please prepend
-debugand-consolelogineclipse.ini? Maybe then you see a swallowed exception when you close thePreferences->Java-Code Style=>Formatterwindow. Or when pressingCtrl-Shift-F.sormuras commentedon Feb 9, 2017
Erm, what exactly do you mean with open gerrit in:
The project named "gerrit" or another addon/plugin?
Does "gerrit" use the default text editor?
What happens, if you "File -> Open File..." an simple .java file and try to format this?
davido commentedon Feb 9, 2017
Oh, sorry for the noise. It was project specific formatting setting for Gerrit project: [1].
sormuras commentedon Feb 9, 2017
😉
davido commentedon Feb 9, 2017
Here is the fix for the problem above: [1].