You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CodeAction: convert lambda expression declaration to function #23299
changed the title [-]codeAction: convert lambda expression declaration to function [/-][+]CodeAction: convert lambda expression declaration to function [/+]on Apr 10, 2018
We're a team of two, currently on our bachelor thesis. We'd like to implement this issue. Estimated timeframe is about 2 weeks, at most 4 weeks. We're looking to do other refactorings and code fixes as well, but this would come first.
I don't know about other countries, but I don't see why it couldn't. It's approved anyway. We're already 3 weeks in. It's more of an engineering project than anything else.
I looked it up anyway, because I was curious. I didn't find any restrictions regarding license.
I've got a question about reversing your example, Wenlu Wang (@Kingwl). Of course, reversing an anonymous function makes sense. (More likely to go from right to left here)
Activity
[-]codeAction: convert lambda expression declaration to function [/-][+]CodeAction: convert lambda expression declaration to function [/+]Kingwl commentedon Apr 12, 2018
from IDEA
zaaack commentedon Apr 12, 2018
+1. Add braces is very useful, too.
zzj3720 commentedon Apr 12, 2018
+1. Add braces is very useful, too.
AngryPowman commentedon Apr 12, 2018
Kingwl's proposals always help me a lot.
vizee commentedon Apr 12, 2018
Kingwl's proposals always help AngryPowman a lot.
ly0 commentedon Apr 12, 2018
Kingwl's proposals always help AngryPowman a lottery.
DanielRosenwasser commentedon Apr 12, 2018
latyas (@ly0)'s comments always help reiterate vizee (@vizee)'s points.
whtsky commentedon Apr 18, 2018
I can't live without Kingwl's proposals.
D0nGiovanni commentedon Oct 3, 2018
Hi
We're a team of two, currently on our bachelor thesis. We'd like to implement this issue. Estimated timeframe is about 2 weeks, at most 4 weeks. We're looking to do other refactorings and code fixes as well, but this would come first.
Kingwl commentedon Oct 5, 2018
could bachelor thesis based on an open source project with Apache License 2.0?😂
I suggest you confirm it in advance.
D0nGiovanni commentedon Oct 5, 2018
I don't know about other countries, but I don't see why it couldn't. It's approved anyway. We're already 3 weeks in. It's more of an engineering project than anything else.
I looked it up anyway, because I was curious. I didn't find any restrictions regarding license.
But we're getting slightly off-topic here... :P
D0nGiovanni commentedon Oct 12, 2018
I've got a question about reversing your example, Wenlu Wang (@Kingwl). Of course, reversing an anonymous function makes sense. (More likely to go from right to left here)
to
or even
to
But what about named function to lambda? Is that actually a use-case? Afaik, Webstorm does not support this. Maybe for a good reason?
to
Last question (for now): Do we also support lambda to method? Of course, we would have to check for class scope.
to
Kingwl commentedon Oct 12, 2018
lambda to methodor the first case seems another refactorextract to(or combined more transform)if you want to edit, convert, or transform the parameter, but actually, add braces could cover the case
D0nGiovanni commentedon Oct 12, 2018
You are right. They are different - and also already implemented.
So to clarify, there are only 2 cases that are in the scope of this refactor. Your example and this:
someFunction(function (arg) { return <div>{arg}foo</div>; });<=>someFunction(arg => <div>{arg}foo</div>);Edit: But
lambda to named functionshould not be supported because of hoisting - or loss thereof.Merge pull request #13 from D0nGiovanni/d-lambda-to-fn
Kingwl commentedon Jun 2, 2020
Thanks!