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

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

Closed
WhistleWhileYouWork opened this issue Aug 11, 2019 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release

Comments

@WhistleWhileYouWork
Copy link

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.
@WhistleWhileYouWork WhistleWhileYouWork added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Aug 11, 2019
@ascheucher
Copy link

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

@ascheucher
Copy link

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.

@WhistleWhileYouWork
Copy link
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?

@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Aug 12, 2019
@kimadeline kimadeline added needs PR regression Bug didn't exist in a previous release and removed triage labels Aug 12, 2019
@kimadeline
Copy link

Hi @WhistleWhileYouWork and @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.

@ericsnowcurrently
Copy link
Member

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

@ericsnowcurrently ericsnowcurrently removed their assignment Aug 13, 2019
@ghost ghost removed the needs PR label Aug 13, 2019
@luabud
Copy link
Member

luabud commented Aug 13, 2019

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)

@lock lock bot locked as resolved and limited conversation to collaborators Aug 20, 2019
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 regression Bug didn't exist in a previous release
Projects
None yet
Development

No branches or pull requests

8 participants