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
{{ message }}
Repository navigation
Python running selection within function causes indentation error #4101
Python version (& distribution if applicable, e.g. Anaconda): 2.7.15
Expected behaviour
After selecting indented lines (i.e.) inside a function/method/class and hitting Shift+Enter, code should execute in terminal without raising IndentationError.
Actual behaviour
For code:
def square(i):
s = i*i
s2 = s+1
return s2
selecting two lines with variable manipulation causes error.
Steps to reproduce:
Create python source file.
Create function inside it
Select lines inside the function
Press Shift+Enter to run the selection
Output
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> s = i*i
File "<stdin>", line 1
s = i*i
^
IndentationError: unexpected indent
>>> s2 = s+1
File "<stdin>", line 1
s2 = s+1
^
IndentationError: unexpected indent
>>>
Thanks for bringing this up, Michał Kaczanowicz (@vicrac). I've verified (on linux) with the latest release of the extension that this is failing as described. We'll working on fixing it.
Activity
ericsnowcurrently commentedon Feb 4, 2019
Thanks for bringing this up, Michał Kaczanowicz (@vicrac). I've verified (on linux) with the latest release of the extension that this is failing as described. We'll working on fixing it.
ericsnowcurrently commentedon Feb 4, 2019
FWIW, this reminds me of something we fixed a while back. Don Jayamanne (@DonJayamanne), do you remember that? I'm pretty sure you worked on it.
DougPlumley commentedon Jun 25, 2019
Michał Kaczanowicz (@vicrac) - I believe this has been resolved as of today.
#2837
https://marketplace.visualstudio.com/items/ms-python.python/changelog