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

SHIFT+ENTER on a return statement should run the whole function #22330

Closed
TylerLeonhardt opened this issue Oct 24, 2023 · 4 comments
Closed

SHIFT+ENTER on a return statement should run the whole function #22330

TylerLeonhardt opened this issue Oct 24, 2023 · 4 comments
Assignees
Labels
area-repl info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@TylerLeonhardt
Copy link
Member

Testing #22287

def foo():
    return 1

when you do SHIFT+ENTER on the return line, you get:

File "<stdin>", line 1
SyntaxError: 'return' outside function

Maybe this could run the entire function?

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 24, 2023
@karthiknadig
Copy link
Member

Few more cases to consider:

def foo(x):
    if x:
        return 0 # what should happen here
    return 1
def foo():
    def bar(x):
        return 0 if x else 1 # what should happen here
    return (bar(x) for x in range(10)) # what should happen here

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Nov 1, 2023
@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Nov 2, 2023
@mRcSchwering
Copy link

For me this does already happen with classes. The whole class definition is "executed" in the integrated terminal if I do shift + enter on one line within the class definition.

I hate this behaviour.

@anthonykim1
Copy link

@mRcSchwering There is now setting to disable this on insiders. If you search 'repl' in your settings there should be a toggle on/off for Smart Send. Otherwise you may just simply highlight the text you wish you run and then pressing shift+enter to run what you want specifically.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Nov 27, 2023
Copy link

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.

Happy Coding!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-repl info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

5 participants