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

Combination of Docstring and empty line in function breaks sending code to REPL (IndentationError) #24083

Closed
thunfischtoast opened this issue Sep 10, 2024 · 4 comments
Assignees
Labels
area-repl bug Issue identified by VS Code Team member as probable bug

Comments

@thunfischtoast
Copy link

Type: Bug

Behaviour

When sending a function to the built-in REPL using Shift+Enter the combination of a Docstring under the function header and a empty line will result in an IndentationError: unexpected indent.

The empty line is automatically created by auto-formatters like black or ruff.

Steps to reproduce:

  1. Creata a new *.py file.

  2. Add this function:

def some_function():
    """Test"""

    print("Hello World")
  1. Select the code and press Shift+Enter.

Diagnostic data

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

Python 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def some_function():
...     """Test"""
... 
>>>     print("Hello World")       
  File "<stdin>", line 1
    print("Hello World")
IndentationError: unexpected indent
>>> 
>>>

Using ipython-REPL it works.

Extension version: 2024.15.2024091001
VS Code version: Code 1.93.0 (4849ca9bdf9666755eb463db297b69e5385090e3, 2024-09-04T13:02:38.431Z)
OS version: Windows_NT x64 10.0.19044
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.8
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
autoDocstring - Python Docstring Generator njpwerner.autodocstring 0.6.1
Black Formatter ms-python.black-formatter 2024.2.0
Excel Viewer GrapeCity.gc-excelviewer 4.2.62
Git Graph mhutchie.git-graph 1.30.0
GitLens — Git supercharged eamodio.gitlens 15.4.0
JavaScript Debugger ms-vscode.js-debug 1.93.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.3
Jupyter ms-toolsai.jupyter 2024.8.1
Jupyter Cell Tags ms-toolsai.vscode-jupyter-cell-tags 0.1.9
Jupyter Keymap ms-toolsai.jupyter-keymap 1.1.2
Jupyter Notebook Renderers ms-toolsai.jupyter-renderers 1.0.19
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
Pylance ms-python.vscode-pylance 2024.9.1
Python ms-python.python 2024.15.2024091001
Python Debugger ms-python.debugpy 2024.10.0
Quarto quarto.quarto 1.114.0
Rainbow CSV mechatroner.rainbow-csv 3.12.0
Remote - SSH ms-vscode-remote.remote-ssh 0.114.1
Remote - SSH: Editing Configuration Files ms-vscode-remote.remote-ssh-edit 0.86.0
Remote Explorer ms-vscode.remote-explorer 0.4.3
Ruff charliermarsh.ruff 2024.44.0
SQLite Viewer qwtel.sqlite-viewer 0.5.13
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.9
System Info
Item Value
CPUs Intel(R) Core(TM) i5-10600 CPU @ 3.30GHz (12 x 3312)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.72GB (3.95GB free)
Process Argv --crash-reporter-id 58fa716e-3aec-4d0d-be90-ff64231c6304
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
jg8ic977:31013176
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
impr_priority:31102340
refactort:31108082
pythonrstrctxt:31112756
flightc:31134773
wkspc-onlycs-t:31132770
wkspc-ranged-c:31125598
cf971741:31134768
ei213698:31121563

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Sep 10, 2024
@kitman1250
Copy link

I've been getting very similar issues. "Glad" to see I'm not the only one. #24069

@adamrickayzenanvil
Copy link

I am getting this as well, preventing me from doing any work. I've tried everything I can think of including downgrading, rebinding keys, uninstalling etc

@thunfischtoast
Copy link
Author

thunfischtoast commented Sep 10, 2024

I downgraded the extension version to v2024.12.3 where the problem was not present. Updating to v2024.14.0 reintroduces it.

@anthonykim1 anthonykim1 added area-repl bug Issue identified by VS Code Team member as probable bug and removed triage-needed Needs assignment to the proper sub-team labels Sep 11, 2024
@anthonykim1
Copy link

Hi folks, thanks for filing this issue - Looks like its a dup with #24069 Lets track it in one place

@anthonykim1 anthonykim1 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-repl bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

4 participants