-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have "Run Selection/Line in Python terminal" work with "Start REPL" #22242
Comments
Resolves: #22242 Attempting to keep instance of REPL. Did not end up using shell integration for this, but shell integration and exit code will come in handy when we have to keep track of 'opened' state of REPL instance for cases when user wants to enter 'exit()'
Resolves: microsoft#22242 Attempting to keep instance of REPL. Did not end up using shell integration for this, but shell integration and exit code will come in handy when we have to keep track of 'opened' state of REPL instance for cases when user wants to enter 'exit()'
Verification steps:
|
@eleanorjboyd could you to toggle off switch in setting to not send to native REPL? Try shift+enter and the command 'Start Terminal REPL' then. Shift+enter (run selection) will bind to either send commands to Terminal REPL or the new REPL depending on the setting. |
On Windows 11, no matter what value I use for python.REPL.sendToNativeREPL, I notice that Start Terminal REPL always creates a terminal REPL and that Shift+enter on a line always seems to send it to the Interactive Window. Therefore, steps 4 and 5 both fail. |
Had discussion with @rzhao271 Essentially shift+enter was opening Interactive Window provided by Jupyter (with conda environment in his case), not the new Python REPL because of the setting |
Resolves: microsoft#22242 Attempting to keep instance of REPL. Did not end up using shell integration for this, but shell integration and exit code will come in handy when we have to keep track of 'opened' state of REPL instance for cases when user wants to enter 'exit()'
Should this be live? |
@maflAT yes, it should be in the latest release. |
@anthonykim1 I reopened the issue to see if this is still an issue. |
Hi @maflAT I believe everything is as expected if I didn't miss anything, but feel free to ping me again. Terminal REPL refers to the traditional ">>>" REPL you would get in the bottom of the VS Code editor. Shift+enter will bind send commands either ONE of the Terminal REPL or the Native REPL depending on your setting. (Please make sure to check both the user and workspace setting for this). You should be able to trigger Terminal REPL from the command palette regardless of this setting, but currently no way to trigger Start Native REPL without enabling setting and manually shift+enter on a Python file (this will come soon!) Jupyter should not be involved in either of these scenario, so I'm bit lost on the context there. It should say "Python REPL" on the top right hand side of the editor if the native REPL gets launched. |
Oh, I see. I misunderstood then. |
@maflAT Great, yes not at the moment but this should be coming soon! - thanks for your feedback. Will let you know when we push this out on a PR, so you can give it a try. |
Discussed in #22227
Originally posted by cbrnr October 16, 2023
With the new smart Shift+Enter feature, it is now very convenient to run a line (or a selection of lines) of code in the interactive interpreter. After hitting Shift+Enter (or selecting "Run Selection/Line in Python terminal"), a new terminal titled "Python" opens with the interactive interpreter, which accepts intput from this command.
However, I was wondering if I can manually start this terminal (i.e., the Python one, which is connected to the "Run Selection/Line in Python terminal" action). I found the "Python: Start REPL" action, which launches the interactive interpreter, but this terminal does not accept input from Shift+Enter.
Would it be possible to unify these two ways of starting the interactive Python interpreter and/or running code? Or maybe let users decide to which terminal they want to send their Shift+Enter commands? This would be very convenient, because right now the only way to kickstart the interpreter for sending commands is to actually send the first line of code.
The text was updated successfully, but these errors were encountered: