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.

enabling ctrl+enter to execute current line in .py script and moving cursor to next line

See original GitHub issue

Environment data

VS Code version: 1.19.1 Python Extension version: 0.9.1 Python Version: 3.6.2 anaconda OS and version: win10 version 1709 (build 17025.1000)

Actual behavior

ctrl+enter does nothing

Expected behavior

ctrl+enter executes “Run Selection/Line in Python Terminal” [ / python.execSelectionInTerminal ] context menu option and indexes cursor in editor to next line, i.e. like behavior with vscode R extension environment and with vs17 ide python script support.

Steps to reproduce:

  • open .py file in vscode
  • place cursor on a line of script
  • enter “ctrl+enter”

Logs

Output from Python output panel

Output from Console window (Help->Developer Tools menu)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:13
  • Comments:23 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
daehcommented, Apr 2, 2019

ideally this would be indent aware too so that if I execute the first line of a code block the whole block is sent to the kernel (so that you can actually step through your code)

for i in range(2):
    
    ### some code

    for j in range(2): ### execution on this line should run the loop
        print(j)

        
        print('this is still part of the group')

    print('cursor ends up here')
6reactions
kraigbcommented, Apr 24, 2018

Yes, Ctrl+Enter should move to the next line, which makes it consistent with the behavior in PTVS. The auto-move to the next line makes Ctrl+Enter a super-useful tool to step through code. Without it, the utility is much more limited.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code move to next line on run ctrl + enter - Stack Overflow
As explained in this blog post, here is how you can make VS Code run code selections using Ctrl + enter and move...
Read more >
Working with Jupyter code cells in the Python Interactive window
You can then type in code, using Enter to go to a new line and Shift+Enter to run the code. To use the...
Read more >
Interacting With Python
Use Python interactively by typing code directly into the interpreter; Execute code contained in a script file from the command line; Work within...
Read more >
Work with source code | PyCharm Documentation - JetBrains
To add a line before the current one, press Ctrl+Alt+Enter . PyCharm moves the caret to the previous line. To duplicate a line,...
Read more >
Windows / Linux Vim Keybindings Reference for the AWS ...
Description Keybinding Command Backspace one space Shift‑Backspace | Backspace backspace Indent the selection one tab Ctrl‑] blockindent Outdent the selection one tab Ctrl‑[ blockoutdent
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