Skip to content
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

VS Code Insiders don't run the cell with shift+Enter in a .py file with #%% cell separators #24041

Closed
sergei3000 opened this issue Aug 10, 2024 · 5 comments · Fixed by microsoft/vscode-jupyter#16103
Assignees
Labels
area-repl bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@sergei3000
Copy link

Does this issue occur when all extensions are disabled?: Yes/No
It's not possible to use this functionality without the MS Jupyter extension. And only the Insiders version is affected.

  • VS Code Version: Insiders 1.93.0-insider (Universal)
  • OS Version: MacOS Sonoma 14.5 (23F79)

Steps to Reproduce:

  1. Install VS Code Insiders
  2. Install Python and Jupyter extensions by Microsoft (the release ones)
  3. Create a .py file with cell separators like # %% and some code inside a cell
  4. Step into the cell
  5. Try to run the cell with shift+Enter like in the regular non-insiders version
  6. Instead of the "Interactive" window with the set environment (I use conda, install ipykernel into my env), like it works in the regular non-inseder version of vscode, it opens a "Python REPL" window and runs the current line instead of the entire cell. And the environment is something different, I can see it from the fact that it errors out on the line import pandas as pd with ModuleNotFoundError: No module named 'pandas' although pandas is installed in the projects environment.

P.S. The keyboard shortcuts seem to be the same for shift+Enter when I look at them and compare in the regular vscode and in the insiders version.

@vs-code-engineering vs-code-engineering bot added the triage-needed Needs assignment to the proper sub-team label Aug 10, 2024
@mjbvz mjbvz assigned DonJayamanne and rebornix and unassigned chrmarti and mjbvz Aug 19, 2024
@vs-code-engineering vs-code-engineering bot removed the triage-needed Needs assignment to the proper sub-team label Aug 19, 2024
@DonJayamanne DonJayamanne assigned amunger and unassigned DonJayamanne Aug 20, 2024
@amunger
Copy link

amunger commented Aug 20, 2024

Do you have "jupyter.interactiveWindow.textEditor.executeSelection": true set in your settings?
Settings don't carry across insiders <> stable, so maybe it just didn't ever get set?

@amunger amunger added the info-needed Issue requires more information from poster label Aug 20, 2024
@amunger
Copy link

amunger commented Aug 20, 2024

ah, but with # %% code cells, shift+enter should probably just execute the jupyter cell.
@anthonykim1 - we should consider adding !jupyter.hascodecells to the when clause for python.execInREPL

@amunger amunger removed the info-needed Issue requires more information from poster label Aug 20, 2024
@anthonykim1
Copy link

Moving this to Python repo -

@anthonykim1 anthonykim1 transferred this issue from microsoft/vscode Sep 3, 2024
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Sep 3, 2024
@anthonykim1 anthonykim1 added area-repl bug Issue identified by VS Code Team member as probable bug and removed triage-needed Needs assignment to the proper sub-team labels Sep 3, 2024
@anthonykim1 anthonykim1 added this to the September 2024 milestone Sep 3, 2024
@amunger amunger self-assigned this Oct 4, 2024
@anthonykim1
Copy link

anthonykim1 commented Oct 23, 2024

Just testing this out - everything works fine with cells with # %% but trying to shift+enter on any other code not surrounded by # %% fails to be executed in both IW nor native REPL.

Tried to locally add !jupyter.hascodecells inside execInREPL for Python extension gave me no luck :/

If there are instances of # %%, should every shift+enter of code(even code block that are outside of # %%) be sent to interactive window? @amunger

@amunger
Copy link

amunger commented Oct 23, 2024

created a new issue for that - I think that was existing behavior and kind of an edge case

@rzhao271 rzhao271 added the verified Verification succeeded label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-repl bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants