Bad auto indent of line to previous code block when pasting at the beginning of the line
See original GitHub issueIf 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:
- Start with these lines:
if 1 == 1:
print('This line belongs to the if')
newline = 'not part of if'
- Copy to the clipboard this text:
newvar
- Paste the text at the beginning of the line:
|newline = 'not part of if'
(|
symbolizes where the cursor is before paste) - Alternatively: Highlight
newline
and paste over it with copied text.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Auto indent new line within a code block - Meta Stack Overflow
What I do in VS 2015 is: Select all my code and then press CTRL + SHIFT + TAB so it is indented...
Read more >Indentation is messed up when pasting code
Found myself implementing the code. It first pastes then fixes the indentation correctly as far as I could see. function!
Read more >comment indentation can break code indentation
I feel that single line comments that are ALONE on their line should be indented to match the start of the previous line....
Read more >Is there a way to fix multi-line indenting in Sublime Text 3 so ...
On Sublime 3 there's this command called Paste and Indent and the keyboard command for that is Super + shift + V where...
Read more >REPL, copy/paste and auto indent in julia 0.7 - General Usage
If you have a large code block, a few hundred lines, the REPL takes very very long to digest what has been pasted...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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)
I was able to verify that the example from @WhistleWhileYouWork works now (on both Linux and Windows).