How can I configure List Indices Alignment option for Reformat?

Let's suppose I want Reformat to work like this:

ingredients[
    123123123:
    123123123123
]

However, I cannot find any option that is related to Array Indices. No matter what I try I always get Reformat to work like this:

ingredients[
123123123:
123123123123
]

What configuration I can change for this situation?

3 comments
Comment actions Permalink

Hi,

Maybe it's just me, but I fail to see the point of such formatting. What is the object you referring to? Please provide a working code snippet. For example, I can understand:

ingredients = [
1,
2,
3
]

That's formatted normally. Please provide your example.

0
Comment actions Permalink

The use case is something like this:

a_list = [1, 2, 3, 4, 5]
index_begin = 2
index_end = 4

# The following code is equivalent to part_of_the_list = [index_begin:index_end].
# part_of_the_list == [3,4,5]
part_of_the_list = [
index_begin
:index_end
]

Unlike this brief example, inside my actual code there is some longer index because of function calls, etc. (like, instead of index_begin there's something like calculate_index_begin(variable_one, variable_two))

0
Comment actions Permalink

Ok, I see what you mean. However I've never seen anyone trying to use index ranges like this

a_list = [1, 2, 3, 4, 5]
a_list[
2:
4
]

But maybe it's just me. While I think that you should just write it in one line, `a_list[2:4]` , feel free to submit this as a bug report to our issue tracker: https://youtrack.jetbrains.com/issues/PY

Refer to the following article if you're not familiar with YouTrack:
https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications

0

Please sign in to leave a comment.