Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python indentation broken after b'{' #140

Open
ghost opened this issue Nov 3, 2020 · 3 comments · May be fixed by #145
Open

Python indentation broken after b'{' #140

ghost opened this issue Nov 3, 2020 · 3 comments · May be fixed by #145
Labels

Comments

@ghost
Copy link

ghost commented Nov 3, 2020

A byte string like b'{ with no } breaks python-indent, resulting in the following indentation:

def parse_license(license):
    if license.startswith(b'{'):
                             print('json license')
                             else:
                             print('regular license')

This does not happen with a regular string ('{') or a raw string (r'{').

@ghost
Copy link
Author

ghost commented Nov 3, 2020

Seems like it's actually caused by another plugin (see vim-python/python-syntax#75). vim-python-pep8-indent alone does not trigger the bug, but the two together make it even worse than just python-syntax alone.

@blueyed blueyed added the bug label Nov 3, 2020
@prayatharth
Copy link

can i try to fix this ?
i am a beginner but will try my best. :)

@blueyed
Copy link
Member

blueyed commented Nov 9, 2020

@prayatharth
Sure! Although you should know your way around (debugging) Vimscript already I guess.

As for the issue: there is some special handling of syntax attributes already (https://github.com/blueyed/vim-python-pep8-indent/blob/978a5ccd61a69751a7893d01f41561897127d9dc/indent/python.vim#L72) - likely it does not catch the one from python-syntax or something like that.

@yut23 yut23 linked a pull request Jan 31, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants