tornadofx-idea-plugin icon indicating copy to clipboard operation
tornadofx-idea-plugin copied to clipboard

Add hint to simplify builder statements

Open nimakro opened this issue 8 years ago • 3 comments

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 avatar Jul 29 '17 21:07 nimakro

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.

edvin avatar Jul 29 '17 21:07 edvin

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.

nimakro avatar Jul 30 '17 16:07 nimakro

That would be extremely cool :)

edvin avatar Jul 30 '17 17:07 edvin