Skip to content

Make python.execInREPL keep focus on editor #23843

Closed

Description

When I am in a Python editor and run python.execInREPL it will send selected code to the Python REPL and then switch the window focus. I would like the option to keep the focus on the editor window, similar to the behavior of Jupyter's Run Selection/Line in Interactive Window.

Activity

  1. github-actions commented on Jul 22, 2024

    @github-actions

    Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.

  2. stevenae commented on Aug 7, 2024

    @stevenae

    This was added as a feature years ago[1]. Seems like a regression and therefore a bug:

    1 - #60 / #651

  3. hutch3232 commented on Aug 7, 2024

    @hutch3232

    I think the difference is that this issue is for the new native REPL and the linked issue/PR is for the terminal based REPL. But I think having these as a reference is useful for extra context.

  4. hutch3232 commented on Sep 5, 2024

    @hutch3232

    It looks like there is quite a bit of interest in this. Has now exceeded the required 7 upvotes. Hope this feature gets taken up!

  5. ssfrr commented on Oct 1, 2024

    @ssfrr

    FWIW this SO post has a workaround. I've tweaked the "when" clause so that the keybinding is a little more targeted. Add this to your keybindings:

        {
            "key": "shift+enter",
            "command": "runCommands",
            "when": "editorTextFocus && activeEditor != 'workbench.editor.notebook' && editorLangId == 'python'",
            "args": {
                "commands": [
                    "python.execInREPL",
                    "workbench.action.focusFirstEditorGroup"
                ]
            }
        }
  6. amunger commented on Oct 25, 2024

    @amunger

    Anthony Kim (@anthonykim1) - I feel like the default should be to keep the focus in the editor, trying to just shift+enter down a file requires you to move focus back after every execution, and really makes the smart execute feature less effective.

    executeToREPL.mp4
  7. anthonykim1 commented on Oct 28, 2024

    @anthonykim1

    thanks all for great feedback. Let me bring this up to the team and try to make it happen soon.

  8. added a commit that references this issue on Nov 8, 2024
    aae2b63
  9. anthonykim1 commented on Dec 2, 2024

    @anthonykim1

    Verification steps:

    1. Make sure you are on latest insiders and latest pre-release version of Python extension
    2. Make sure to turn ON the setting to send command to native repl (check both workspace and user setting for 'send to native repl'
    3. Open Python file and press shift+enter
    4. Observe that the focus is still in the Python file itself and not stolen via native repl.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions