comprehension identation
Answered
i have the following auto formatted code:
[
item
for item in
some_list
if (
another_condition
or third_condition
) and condition
]
i would like it to be formatted like:
[
item
for item in
some_list
if (
another_condition
or third_condition
) and condition
]
similar problem:
[
item
for item in
some_list
if condition and (
another_condition
or third_condition
)
]
should be:
[
item
for item in
some_list
if condition and (
another_condition
or third_condition
)
]
Is this possible? what settings are required?
code style export:
<code_scheme name="Project" version="173">
<Python>
<option name="ALIGN_COLLECTIONS_AND_COMPREHENSIONS" value="false" />
<option name="NEW_LINE_AFTER_COLON" value="true" />
<option name="DICT_WRAPPING" value="2" />
<option name="DICT_NEW_LINE_BEFORE_RIGHT_BRACE" value="true" />
<option name="FROM_IMPORT_NEW_LINE_AFTER_LEFT_PARENTHESIS" value="true" />
<option name="FROM_IMPORT_NEW_LINE_BEFORE_RIGHT_PARENTHESIS" value="true" />
<option name="FROM_IMPORT_PARENTHESES_FORCE_IF_MULTILINE" value="true" />
</Python>
<codeStyleSettings language="Python">
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="false" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
Please sign in to leave a comment.
It seems you are looking for Continuation indent in Preferences | Editor | Code Style | Python
Changing it to 4 should do the trick.
it should already be 4.
looks correct in the export too:
my default code style: