question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
luabudcommented, 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)

0reactions
ericsnowcurrentlycommented, Aug 13, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found