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

Chained method wrapping conditional on the length of the root #571

Open
kevinresol opened this issue Apr 8, 2020 · 0 comments
Open

Chained method wrapping conditional on the length of the root #571

kevinresol opened this issue Apr 8, 2020 · 0 comments
Labels
enhancement New feature or request wrapping Incorrect or undesirable wrapping

Comments

@kevinresol
Copy link

Preface
Currently I have a snippet being weirdly formatted like this:

writeToFile('out/test.xlsx',
	attendance.byAreaAndWorker(null, null)).next(_ -> 'out/test.xlsx'.stat())
	.next(s -> asserts.assert(s.size > 0))
	.handle(asserts.handle);

Tried a few conditional settings but have no luck. I hope it could be nicer like so:

writeToFile('out/test.xlsx', attendance.byAreaAndWorker(null, null))
	.next(_ -> 'out/test.xlsx'.stat())
	.next(s -> asserts.assert(s.size > 0))
	.handle(asserts.handle);

If there are some conditional tricks that can achieve that, it would be nice to know. Otherwise I suggest the following feature.

Feature Request

I wish to have method chaining wrapping based on the length of the "root" (i.e. the stuff before the first method call).

e.g. {"cond": "rootLength <= n", "value": 10}

root.method().chaining();
// becomes:
root.method()
  .chaining();
very.long.non.method.root.method().chaining();
// becomes:
very.long.non.method.root
  .method()
  .chaining();
@AlexHaxe AlexHaxe added enhancement New feature or request wrapping Incorrect or undesirable wrapping labels Apr 8, 2020
@AlexHaxe AlexHaxe added this to the Wrapping code generation 5 milestone Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wrapping Incorrect or undesirable wrapping
Projects
None yet
Development

No branches or pull requests

2 participants