DonJayamanne / vscodeJupyter

Jupyter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=donjayamanne.jupyter
MIT License
335 stars 34 forks source link

'jupyter: Run selection/line'should support running multi-line expression ... #95

Open DonJayamanne opened 6 years ago

DonJayamanne commented 6 years ago

From @DonJayamanne on November 14, 2017 16:53

From @breathe on November 2, 2017 16:48

Environment data

VS Code version: Version 1.17.2 (1.17.2) Python Extension version:
Python Version: Python 3.6.1 :: Continuum Analytics, Inc. OS and version: Mac OS 10.12.6

Actual behavior

Given code:

ENV_ID = next(
    v for v in ENVIRONMENTS["environments"] if v["name"] == "SOMETHING")

Run selection/line on ENV_ID = next gives

Append ResultsClear Results
  File "<ipython-input-71-55cab482bb4f>", line 1
    ENV_ID = next(
                  ^
SyntaxError: unexpected EOF while parsing

Run selection/line on line 2 gives:

Append ResultsClear Results
  File "<ipython-input-72-cfae9e3f6267>", line 1
    v for v in ENVIRONMENTS["environments"] if v["name"] == "AARP_DISCOVERY_DEV")
        ^
SyntaxError: invalid syntax

This is particularly annoying when using the python auto-formatter as lines are frequently reformated into multi-line expressions based on character count ...

Expected behavior

Should parse and run the multi-line expression

Steps to reproduce:

Run selection/line on a multi-line expression

Copied from original issue: DonJayamanne/pythonVSCode#1365

Copied from original issue: Microsoft/vscode-python#213