Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This tightens the AST compact printing #2872

Merged
merged 3 commits into from Jun 29, 2022
Merged

Conversation

bbakerman
Copy link
Member

See #2869

Tests need to be fixed

@bbakerman bbakerman added this to the 19.0 milestone Jun 24, 2022
@SuppressWarnings("SameParameterValue")
private <T extends Node> String jointight(List<T> nodes, String delim, String prefix, String suffix) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hyper nit: could you make it camelCase joinTight

For people with poor eyesight like me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (first) {
first = false;
} else {
boolean canButtTogether = lastNodeText.endsWith("}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean canPutTogether?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok you win this time

output == '''{aliasOfFoo:foo(arg1:"val1",args2:"val2") @isCached {hello} world @neverCache @okThenCache} fragment FX on SomeType {aliased:field(withArgs:"argVal",andMoreArgs:"andMoreVals")}'''
isParseableAst(output)
output == '''{aliasOfFoo:foo(arg1:"val1",args2:"val2") @isCached{hello}world @neverCache @okThenCache} fragment FX on SomeType {aliased:field(withArgs:"argVal",andMoreArgs:"andMoreVals")}'''
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also tighten directives

{foo(arg1:"val1",args2:"val2") @isCached{hello}world @neverCache @okThenCache}}

{foo(arg1:"val1",args2:"val2")@isCached{hello}world@neverCache@okThenCache}}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants