I want to run the select code of python in VScode. Till now, I have to copy the code and paste it in the terminal below to run. The system is mac OS. So is there any way to run the code directly after I selected the code? For example, like the shortcuts. Thanks.
@yanachen, this is now possible in VS Code. All you need to do is:
1. Ensure python is running in the VS Code terminal window
2. Select the text you wish to execute in python
3. Invoke the command 'workbench.action.terminal.runSelectedText' as defined in the following link:
https://code.visualstudio.com/docs/editor/integrated-terminal#_key-bindings
There is no default keybindings for command "Run Selected Text in Active Terminal", but you can create one.
workbench.action.terminal.runSelectedText
in keybindings.Tested on VSCode 1.30.2 on Windows 10 Pro.
Now it's supported by default shortcut "shift" + "enter".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With