prettier/plugin-python

tokenizing errors

ranshamay opened this issue · 0 comments

hi guys, great work!
i just ran the prettier on one of my projects and i got some bugs,

all of the above happen in python 2.7
1.on slice notation, its not detecting the parenthesis,
for example,
before prettier:
some_var[1:]
after prettier:
some_var[1]
2.on not clause, not token will concatenate to the next token,
before prettier:
if not is_something:
do_something()
after prettier:
if notis_something:
do_something()
3.function signature with default values and splitted to few lines doesnt work well:
before prettier:
def init(self, db_mail_info=None,
email_sent_time=None):
after prettier:
def init(self, db_mail_info, email_sent_time=None, ):
4. mixed and or statement removes parenthesis so the logic is changing:
before prettier:
if x and (y or z):
do_something()
after prettier:
if x and y or z:
do_something()

thanks!