Skip to content

Run Selected Text in Active Terminal gives IndentationError with IPython #8945

@iutlu

Description

@iutlu

Environment data

  • VS Code version: 1.40.2
  • Extension version (available under the Extensions sidebar): 2019.11.50794
  • OS and version: macOS Catalina 10.15.1
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.5 Anaconda defaults
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: XXX
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): Language Server

Expected behaviour

Selecting some text and running the command "Terminal: Run Selected Text In Active Terminal" properly pastes the selection to an IPython console.

Actual behaviour

IndentationError is received.

Steps to reproduce:

  1. Launch IPython in the built-in terminal. Then open some file in the editor; type and select
for x in range(3):
    print(x)
    break
  1. Execute the command "Terminal: Run Selected Text in Active Terminal"

The following error is received:

In [1]: for x in range(3): 
   ...:         print(x) 
   ...:             break                                                                              
  File "<ipython-input-1-6c59f84e067e>", line 3
    break
    ^
IndentationError: unexpected indent

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

No output

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

No output

Metadata

Metadata

Assignees

Labels

area-terminalbugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked on

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions