Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Open-ended slice notation gets removed #77

Closed
IamJeffG opened this issue Mar 22, 2018 · 1 comment
Closed

Open-ended slice notation gets removed #77

IamJeffG opened this issue Mar 22, 2018 · 1 comment

Comments

@IamJeffG
Copy link

If my code is slicing a list and not specifying start or end, prettier will remove the open-ended side, i.e. the hanging colon. This results in code that executes differently (or sometimes a syntax error).

$ echo "print(test[1:])" > bug_demo.py 
$ prettier bug_demo.py 
print(test[1])

$ echo "print(test[:])" > bug_demo.py 
$ prettier bug_demo.py 
print(test[])

The bug doesn't happen when both start and end are given for the slice range.

$ echo "print(test[1:3])" > bug_demo.py 
$ prettier bug_demo.py 
print(test[1:3])
@FuegoFro
Copy link
Collaborator

Hm, this doesn't repro for me on master, and I'm pretty sure it was fixed by #37. I'm gonna go ahead and close this out, but feel free to re-open if I'm mistaken and it still looks like an issue!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants