Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VScode run code selection

I just made the transition from Spyder to VScode for my python endeavours. Is there a way to run individual lines of code? That's how I used to do my on-the-spot debugging, but I can't find an option for it in VScode and really don't want to keep setting and removing breakpoints.

Thanks.

like image 342
JFern Avatar asked Apr 11 '18 09:04

JFern


People also ask

How do I run a section of VS Code?

Users can right-click the text editor and then select “Run Code” in the context menu. With only two clicks, your code will run. “Run Code” is also an option in the editor title menu and the file explorer's context menu.

How do I run code in VS Code terminal?

You can also run VS Code from the terminal by typing 'code' after adding it to the path: Launch VS Code. Open the Command Palette (Cmd+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.


1 Answers

If you highlight some code, you can right-click or run the command, Run Selection/Line in Python Terminal.

We are also planning on implementing Ctrl-Enter to do the same thing and looking at Ctr-Enter executing the current line.

like image 106
Brett Cannon Avatar answered Oct 02 '22 22:10

Brett Cannon