forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Milestone
Description
- macOS @bpasero
- linux @TylerLeonhardt
- windows @Tyriar
Complexity: 4
Thank you in advance for testing REPL Smart Send feature!
Please let me know if you have any questions, problems, comments.
I hope you enjoy this feature whenever you want to shift+enter through your Python file!
Background Information
REPL Smart Send consists two integrated features(referenced above) that are shipped together to provide smoother Python REPL experience with Shift+Enter:
- Smart Selection: User (who is not highlighting/explicitly selecting any text) should be able to have their mouse cursor in some point of their Python code, and we should be able to detect, send minimum functional code to the REPL when Shift+Enter is pressed.
- Dynamic Cursor Move: When user shift+enters with no highlight/no explicit selection of the text, mouse cursor should move to next executable code in the currently opened Python document.
Setup:
- Make sure you are using Python3.8 or above. This feature will only work for Python3.8 and above. (3.8 is the minimum official support that VS Code Python repository have at the moment)
- Make sure you have pythonREPLSmartSend experiment enabled. You can do this by editing your settings.json to have
"python.experiments.enabled": true,
"python.experiments.optInto": ["pythonREPLSmartSend"],
Steps
- Open Python file of your choice. You can start with empty Python file and code your own Python code!
- Place your cursor wherever you would like in your Python code and press shift+enter.
- Observe that it sends minimum viable/functional code to the Python REPL.
- Observe that the mouse cursor is moved to the next executable block of code in the Python file.
- Try with code block that are multi-line, such as but not limited to multi-line dictionary, lists.
- Try shift entering AT higher level code block such as where functions are defined with: """def whatever_function:""" (cursor should be exactly at declaration of top level block you want to send)
- Observe that whole higher level code block (in this case, function) is sent to the REPL and cursor is moved appropriately to after the block shift entered on (in this case cursor should be on executable code presented after whatever_function)
- If you press shift+enter inside higher block of code (in this case, inside the function), it should only send that independent and hence the minimum viable code (in this case, print statement) to the REPL
- Play around with any Python code block you want to test with, and see if appropriate "smart" code block is sent to the REPL, as well as the appropriate mouse cursor move you will see in your file editor window!
Note: Smart Send will only work when there is NO EXPLICIT selection, meaning NO EXPLICIT highlighting of the text.