You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extension version (available under the Extensions sidebar): 2018.9.0 (9 Oct 2018)
OS and version: Windows 10 Enterprise
Python version (& distribution if applicable, e.g. Anaconda): Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32.
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Miniconda, conda 4.5.11
Relevant/affected Python packages and their versions: NA
Actual behavior
Selecting the function definition in the code below (all the rows before v = add(1, 7))
def add(x, y):
"""Adds x to y"""
# Some comment
return x + y
v = add(1, 7)
print(v)
and running "Run Selection/Line in Python Terminal" [ / python.execSelectionInTerminal ] produces an error. Please note that there are no blank lines within function definition and there is a final blank line after the 'return x+y' statement
Expected behavior
The behavior is fine when saving the code above in a file "test_indent.py" and executing via command prompt python test_indent.py
the result is 8
Steps to reproduce:
create a new file in Visual Studio code
Copy the code above
Select all the lines of function definition
"Run Selection/Line in Python Terminal" with right click option or Shift+Enter shortcut
Logs
Output for Python in the Terminal Window
>> def add(x, y):
...
File "<stdin>", line 2
^
IndentationError: expected an indented block
>>> """Adds x to y"""
File "<stdin>", line 1
"""Adds x to y"""
^
IndentationError: unexpected indent
>>>
>>> # Some comment
...
>>> return x + y
File "<stdin>", line 1
return x + y
^
IndentationError: unexpected indent
The text was updated successfully, but these errors were encountered:
Environment data
Actual behavior
Selecting the function definition in the code below (all the rows before
v = add(1, 7)
)and running "Run Selection/Line in Python Terminal" [ / python.execSelectionInTerminal ] produces an error. Please note that there are no blank lines within function definition and there is a final blank line after the 'return x+y' statement
Expected behavior
The behavior is fine when saving the code above in a file "test_indent.py" and executing via command prompt
python test_indent.py
the result is
8
Steps to reproduce:
Logs
Output for
Python
in the Terminal WindowThe text was updated successfully, but these errors were encountered: