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

Auto-indent for Python spotty #11909

Closed
cajuntechie opened this issue Sep 12, 2016 · 2 comments
Closed

Auto-indent for Python spotty #11909

cajuntechie opened this issue Sep 12, 2016 · 2 comments

Comments

@cajuntechie
Copy link

cajuntechie commented Sep 12, 2016

  • VSCode Version: 1.5.2
  • OS Version: Windows 8.1 and Ubuntu Linux 16.04

When writing certain Python code, auto-indent/de-indent fails to properly indent/de-indent lines as expected. For example, if I write:

if myVar == 1:
    print("This is equal to 1")
else:
    print ("This is not equal to 1")

The editor fails to automatically indent the "else" statement. it should be able to detect that I am entering an "else" statement and properly handle indentation and de-indentation. The same issue occurs on try/except blocks.

try:
    subprocess.check_output("someprogram.exe")
except CalledProcessException:
    print("The process failed.")

The editor should be able to detect when it sees the except block starter and properly de--indent the code as expected. As it stands, both the if/else and try/except blocks look like this when entered into the editor:

if myvar == 1:
    print("This is equal to 1")
    else:
        print("This is not equal to 1")

@sumit0190
Copy link

I think #2272 addresses the bigger problem that's causing indentation issues across all languages. Solving that should automatically take care of such issues. I could be wrong though.

@bpasero
Copy link
Member

bpasero commented Sep 13, 2016

This should be reported to the Python repository first.

@bpasero bpasero closed this as completed Sep 13, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
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

3 participants