Formatting: spaces between nested brackets


Hello! I am using several JetBrains IDE's (IDEA and PyCharm) and I really miss one thing in them.
In cases, when I have nested round brackets, i.e. in case of nested function calls, it becomes a little bit messy and I would like to have an extra space between each pair or brackets to make the code more clear.

Here is an example of notation without extra spaces:


And here is an example of what I would like to have: object3.getX() ) )

I haven't found such option in code style configuration, so I am doing it manually. But the problem is, that during reformatting the IDE removes the extra spaces.
I wish to know, is there a way of adding such rule to the IDE, so it will automatically reformat code for me, or, at lest, not remove the spaces I have added?

Thank you in advance!

Comment actions Permalink

PyCharm formatter uses code style settings defined in Settings| Editor| Code Style| Python. Please check how it works in your case if enabling Settings| Editor| Code Style| Python| Spaces| Within| Method declaration/call parentheses.

Comment actions Permalink

Hello! Thanks for your comment. But that's not exactly what I need. The options, suggested by you, add spaces all the time. I would like to have it only when there are nested parentheses forming a construction similar to "method1(method2(method3()))". 

Comment actions Permalink

I have found a solution to both of our problems, Settings >> Editor >> Code Style >> Python >> Spaces >> Within >> Method call parenteses [  ] (untick)


Please sign in to leave a comment.