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

Wrong indentation size auto-detection in python #44991

Closed
Eugenii10 opened this issue Mar 4, 2018 · 1 comment
Closed

Wrong indentation size auto-detection in python #44991

Eugenii10 opened this issue Mar 4, 2018 · 1 comment
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@Eugenii10
Copy link

Issue Type

Bug

Description

Actual behavior

VS Code incorrectly determine indentation style as 8 spaces.
actual

Expected behavior

VS Code determine indentation style as 4 spaces.
expected

Steps to reproduce:

  • Launch VS Code
  • Open Untitled-1.py from the attached archive below
    project.zip

VS Code Info

VS Code version: Code 1.20.1 (f88bbf9, 2018-02-13T15:34:36.336Z)
OS version: Windows_NT x64 10.0.14393

System Info
Item Value
CPUs Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz (8 x 2295)
Memory (System) 11.89GB (6.08GB free)
Process Argv D:\Program Files\VSCode\Code.exe
Screen Reader no
VM 0%
Extensions (25)
Extension Author (truncated) Version
orclapex-autocomplete apn 0.0.2
open-html-in-browser cod 0.1.21
bracket-pair-colorizer Coe 1.0.15
xml Dot 1.9.2
vscode-html-css ecm 0.2.0
auto-close-tag for 0.5.6
auto-rename-tag for 0.0.15
code-runner for 0.8.7
scoper Gru 0.0.5
beautify Hoo 1.3.0
python ms- 2018.1.0
debugger-for-chrome msj 4.1.0
python-docs Muk 0.8.3
autodocstring njp 0.2.0
vscode-code-outline pat 0.0.13
java red 0.20.0
guides spy 0.9.1
open-in-browser tec 1.1.0
vscode-java-debug vsc 0.6.0
vscode-java-pack vsc 0.3.0
vscode-java-test vsc 0.3.0
vscode-maven vsc 0.5.2
vscode-todo-highlight way 0.5.11
plsql-language xyz 1.1.2
html-css-class-completion Zig 1.17.1
Reproduces without extensions
@Eugenii10 Eugenii10 changed the title Wrong indentation style (size) auto-detection Wrong indentation size auto-detection in python Mar 4, 2018
@alexdima
Copy link
Member

alexdima commented Mar 5, 2018

Here is the file for easier copy-pasting:

a = 10             # 0 space indent
b = 5              # 0 space indent
if a > 10:         # 0 space indent
    a += 1         # 4 space indent      delta 4 spaces
    if b > 5:      # 4 space indent
        b += 1     # 8 space indent      delta 4 spaces
        b += 1     # 8 space indent
        b += 1     # 8 space indent
# comment line 1   # 0 space indent      delta 8 spaces
# comment line 2   # 0 space indent
# comment line 3   # 0 space indent
        b += 1     # 8 space indent      delta 8 spaces
        b += 1     # 8 space indent
        b += 1     # 8 space indent

There are 2 deltas of 4 spaces, and 2 deltas of 8 spaces. The indentation detector should detect 4 spaces when there is a tie in the delta counts.

@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Mar 5, 2018
@alexdima alexdima added this to the On Deck milestone Mar 5, 2018
@alexdima alexdima modified the milestones: On Deck, May 2018 Apr 30, 2018
@Tyriar Tyriar added the verified Verification succeeded label May 30, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants