Skip to content

Bad auto indent of line to previous code block when pasting at the beginning of the line #6927

Closed

Description

@WhistleWhileYouWork

If a line is below a code block (if, for, try def etc) but not part of the code block and you paste something where the selection start is at the beginning of the line, the line will auto indent to be a part of the code block. This does not occur if the code block ends with return, break, continue etc.

Environment data

Version: 1.37.0 (user setup)
Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
Date: 2019-08-08T02:33:50.993Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.17763
Python Extension: 2019.8.29288
Python Language Server: 0.3.46

Expected behaviour

if 1 == 1:
    print('This line belongs to the if')
newvar = 'not part of if'

Actual behaviour

For pasting at beginning of line (see 3. below)

if 1 == 1:
    print('This line belongs to the if')
    newvarnewline = 'not part of if'

For pasting over newline (see 4. below)

if 1 == 1:
    print('This line belongs to the if')
    newvar = 'not part of if'

Steps to reproduce:

  1. Start with these lines:
if 1 == 1:
    print('This line belongs to the if')
newline = 'not part of if'
  1. Copy to the clipboard this text: newvar
  2. Paste the text at the beginning of the line: |newline = 'not part of if'
    (| symbolizes where the cursor is before paste)
  3. Alternatively: Highlight newline and paste over it with copied text.

Activity

  1. added
    triage-neededNeeds assignment to the proper sub-team
    bugIssue identified by VS Code Team member as probable bug
    on Aug 11, 2019
  2. ascheucher commented on Aug 12, 2019

    @ascheucher

    I made the expirience of even modified indentation level of code blocks following the copied in block.

  3. ascheucher commented on Aug 12, 2019

    @ascheucher

    There are also severl other issues on indentation:

    • pressing enter on an empty line jumps to the indentation level of the last line, but should at the same as where the cursor had been
    • Pasting code to the wrong indentation all the time
    • ...

    I had to switch back to the old version of the Python extension. I spend more time to fix wrong intendation (which causes bugs, I am sure you are aware of this!) than on coding the last days.

  4. WhistleWhileYouWork commented on Aug 12, 2019

    @WhistleWhileYouWork
    Author

    At the moment, this is the only other open issue Unexpected indentation behavior after latest update #6886. Does the team want an exhaustive list of all indentation bugs with new issues or to collect them all in #6886 or just wait for a new update to test?

  5. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Aug 12, 2019
  6. kimadeline commented on Aug 12, 2019

    @kimadeline

    Hi WhistleWhileYouWork and Andreas Scheucher (@ascheucher) , thank you for reporting this issue.

    As you mentioned some indentation bugs are already reported in #6886 , so for now we will roll back these changes, and will let you know once it's out there so you can use the latest update.

  7. ericsnowcurrently commented on Aug 13, 2019

    @ericsnowcurrently

    I was able to verify that the example from WhistleWhileYouWork works now (on both Linux and Windows).

  8. luabud commented on Aug 13, 2019

    @luabud
    Member

    We're going to push a hot fix for this soon, but if anyone would like to try it out ahead of time, you can use the Insiders build (here or by opting-in the Insiders program as a daily basis, more details about it in the blog post)

  9. locked as resolved and limited conversation to collaborators on Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugregressionBug didn't exist in a previous release

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions