At one point Java had it too (I implemented it). Because many users found it annoying it was removed. For people never removing braces, the intention to remove braces popping up in every place was quite frustrating. Personally I would vote for removing the intention from JavaScript too.
What I would like to have is an inspection which removes superfluous braces but leaves clarifying braces as is. For example after some heavy refactoring you could end with some code like this:
if ((((flag)) && (((a + b)) == 0))
Instead of removing all braces I would like to end with this:
if (flag && ((a + b) == 0))
Bas Leijdekkers wrote:
At one point Java had it too (I implemented it). Because many users found it annoying it was removed. For people never removing braces, the intention to remove braces popping up in every place was quite frustrating. Personally I would vote for removing the intention from JavaScript too.
Actually, the unnecessary parentheses inspection should already work like this, but I see it has a bug. Please submit a JIRA ticket and I will see if I can get a fix in 8.0.1.
>> There's one thing left. Currently there's no possibility to simplify >> this code: >> >> String s = ((((a + b)) == 0)) ? "a" : "b"; >> >> To this: >> >> String s = ((a + b) == 0) ? "a" : "b"; >> >> IMHO if the second checkbox is set then you should ignore the outermost >> pair of parenthesis, but you should warn on any additional one. >> >> >> Bas Leijdekkers wrote: >>> http://www.jetbrains.net/jira/browse/IDEADEV-32886 >>> Fixed, but in the next minor release after 8.0.1, not in 8.0.1 itself. Please test. >>> >>> Bas >> -- >> Martin Fuhrer >> Fuhrer Engineering AG >> http://www.fuhrer.com >>
At one point Java had it too (I implemented it). Because many users found it annoying it was removed. For people never removing braces, the intention to remove braces popping up in every place was quite frustrating. Personally I would vote for removing the intention from JavaScript too.
Bas
Bas,
What I would like to have is an inspection which removes superfluous
braces but leaves clarifying braces as is. For example after some heavy
refactoring you could end with some code like this:
if ((((flag)) && (((a + b)) == 0))
Instead of removing all braces I would like to end with this:
if (flag && ((a + b) == 0))
Bas Leijdekkers wrote:
--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com
Martin,
Actually, the unnecessary parentheses inspection should already work like this, but I see it has a bug. Please submit a JIRA ticket and I will see if I can get a fix in 8.0.1.
Bas
http://www.jetbrains.net/jira/browse/IDEADEV-32886
Fixed, but in the next minor release after 8.0.1, not in 8.0.1 itself. Please test.
Bas
Hello Bas,
Works much better now, thanks!
There's one thing left. Currently there's no possibility to simplify
this code:
String s = ((((a + b)) == 0)) ? "a" : "b";
To this:
String s = ((a + b) == 0) ? "a" : "b";
IMHO if the second checkbox is set then you should ignore the outermost
pair of parenthesis, but you should warn on any additional one.
Bas Leijdekkers wrote:
--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com
Hello Martin,
This now fixed also. Thanks for the report.
Bas
>
Thanks Bas, works like a charm!
Bas Leijdekkers wrote:
>>
>> There's one thing left. Currently there's no possibility to simplify
>> this code:
>>
>> String s = ((((a + b)) == 0)) ? "a" : "b";
>>
>> To this:
>>
>> String s = ((a + b) == 0) ? "a" : "b";
>>
>> IMHO if the second checkbox is set then you should ignore the outermost
>> pair of parenthesis, but you should warn on any additional one.
>>
>>
>> Bas Leijdekkers wrote:
>>> http://www.jetbrains.net/jira/browse/IDEADEV-32886
>>> Fixed, but in the next minor release after 8.0.1, not in 8.0.1 itself. Please test.
>>>
>>> Bas
>> --
>> Martin Fuhrer
>> Fuhrer Engineering AG
>> http://www.fuhrer.com
>>
--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com
Hi,
How about an option that removes all redundant parentheses? I'm really into minimalism of punctuation.
Randall Schulz
Just uncheck both 'ignore...' checkboxes and you should get what you want.