Skip to content

Commit

Permalink
Handle white spaces for list along with dictionary (#22209)
Browse files Browse the repository at this point in the history
Legacy normalization script leaves unnecessary white spaces for
dictionary as well as list. While there are multiple correct usage of it
such as for after a function, for more intuitive REPL experience. We
want to keep previous normalization style and white space format EXCEPT
for dictionary and list case.

Dictionary case is handled, but this is the PR to handle the elimination
of extra white spaces for list as well.
Closes: #22208
  • Loading branch information
anthonykim1 authored Oct 12, 2023
1 parent ec001a0 commit 6c23e43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pythonFiles/normalizeSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def normalize_lines(selection):

# Insert a newline between each top-level statement, and append a newline to the selection.
source = "\n".join(statements) + "\n"
if selection[-2] == "}":
if selection[-2] == "}" or selection[-2] == "]":
source = source[:-1]
except Exception:
# If there's a problem when parsing statements,
Expand Down

0 comments on commit 6c23e43

Please sign in to comment.