Skip to content

Unable to indent python code under if statement for this particular code #1818

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

Closed
Arpitx opened this issue May 31, 2018 · 2 comments
Closed
Labels
area-formatting bug Issue identified by VS Code Team member as probable bug

Comments

@Arpitx
Copy link

Arpitx commented May 31, 2018

Environment data

  • VS Code version: 1.23.1
  • Extension version (available under the Extensions sidebar): Python (Microsoft) 2018.4.0 (2 May 2018)
  • OS and version: Windows 10 1803
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.4
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: N/A

Actual behavior

Incorrect indentation beneath if statement.

`mystery_int = "catcatcatcatcat"

count = 0

for i in range(1, len(mystery_int)):

if  mystery_string[i-1:i+2] == 'bob':

count += 1

print(count)`

Expected behavior

When I jot down the same code in some other env like pycharm or say python scripter it works fine
`mystery_int = "catcatcatcatcat"

count = 0

for i in range(1,len(mystery_int)):

if mystery_int[i-1:i+2] == 'cat':

    count += 1

print(count)
`

Steps to reproduce:

Logs

Extension - output log 2:

##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1963,0,error,E0001:unexpected EOF while parsing (<string>, line 1963)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1961,0,error,E0001:unexpected EOF while parsing (<string>, line 1961)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1962,0,error,E0001:unexpected EOF while parsing (<string>, line 1962)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1962,0,error,E0001:invalid syntax (<string>, line 1962)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1962,0,error,E0001:invalid syntax (<string>, line 1962)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1962,0,error,E0001:invalid syntax (<string>, line 1962)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1962,0,error,E0001:invalid syntax (<string>, line 1962)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1962,0,error,E0001:invalid syntax (<string>, line 1962)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1964,0,error,E0001:unexpected EOF while parsing (<string>, line 1964)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1967,0,error,E0001:unexpected EOF while parsing (<string>, line 1967)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1967,0,error,E0001:unexpected EOF while parsing (<string>, line 1967)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1967,0,error,E0001:unexpected EOF while parsing (<string>, line 1967)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1967,0,error,E0001:unexpected EOF while parsing (<string>, line 1967)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1962,0,error,E0001:invalid syntax (<string>, line 1962)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1967,0,error,E0001:unexpected EOF while parsing (<string>, line 1967)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1968,0,error,E0001:unexpected EOF while parsing (<string>, line 1968)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1969,0,error,E0001:unexpected EOF while parsing (<string>, line 1969)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1964,0,error,E0001:expected an indented block (<string>, line 1964)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1964,0,error,E0001:expected an indented block (<string>, line 1964)
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module test
1964,0,error,E0001:expected an indented block (<string>, line 1964)

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

E0001:expected an indented block (<string>, line 1964)

VScodeindentation.zip

@brettcannon brettcannon added bug Issue identified by VS Code Team member as probable bug needs verification area-formatting labels May 31, 2018
@Arpitx
Copy link
Author

Arpitx commented May 31, 2018

Please check the attached zip file to see that the code is not working when applying string slicing method.

@DonJayamanne
Copy link

Duplicate of #1461

@DonJayamanne DonJayamanne marked this as a duplicate of #1461 May 31, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-formatting bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants