WIP: little tweak, softline in variable initialization#222
WIP: little tweak, softline in variable initialization#222Hawkurane wants to merge 4 commits intojhipster:masterfrom
Conversation
|
Currently, the java printer is not able to break a variable declaration into two lines such as: private static int some_variable =
some_random_value;I've tried to use a few tricks to make it doable but I can't seem to be able to handle the priority of grouping. // Should be
private static int some_variable = some_random_function(
value1,
value2
);
// This breaks the line when we are using a binary operator instead of breaking the argument list.
private static int some_variable =
some_random_function(value1, value2) + "literal_value";
// What it does no matter what
private static int some_variable =
some_random_function(value1, value2);This suits PrettierJS in this specific case but overrides many other cases (see 2nd example) |
|
The issue is that you cannot tell which group should break in priority with the prettier API : see https://github.com/prettier/prettier/blob/master/commands.md#group
|
|
Indeed it looks like the outermost will always break in priority. |
There was a problem hiding this comment.
lets not merge commented out code 😄
There was a problem hiding this comment.
Yes it is still WIP because I am still trying to fix 2 bugs and I still need the printing.
|
I am closing this PR as this is currently too difficult. I will rework on this at a later date with smaller PR's because this one is dependent of others |
This adds a soft line when initializing a variable. This is get closer to PrettierJS behaviour. See #218.