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

Add hint to simplify builder statements #30

Open
nimakro opened this issue Jul 29, 2017 · 3 comments
Open

Add hint to simplify builder statements #30

nimakro opened this issue Jul 29, 2017 · 3 comments
Assignees

Comments

@nimakro
Copy link
Collaborator

nimakro commented Jul 29, 2017

If a builder only has one statement like:
button("button") { action { println("Hello World") } }
Then the plugin should show a hint to simplified it to this:
button("button").action { println("Hello World") }

@nimakro nimakro self-assigned this Jul 29, 2017
@edvin
Copy link
Owner

edvin commented Jul 29, 2017

This can be problematic, because if something inside the action lambda is accessing the button via this, that code would fail, and even worse, it could end up targeting another component. Something to be aware of at least. Not saying we should add the hint though, as most of the time, this caveat won't be the case.

@nimakro
Copy link
Collaborator Author

nimakro commented Jul 30, 2017

That is right the same is true for runAsyncWithProgress because it would then replace the parent with a progress indicator and not the node we want to show the progress indicator in.

But I don't see why I can't extract that information from the AST. I will give it a shot and see how complicated it will be to implement it.

@edvin
Copy link
Owner

edvin commented Jul 30, 2017

That would be extremely cool :)

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

No branches or pull requests

2 participants