Skip to content

Shift-Enter on long block inserts garbage into terminal, not my actual code #25794

@arencambre

Description

@arencambre

Type: Bug

Behaviour

When I hit shift-enter on a single line of code, it always works fine. If I hit shift-enter on a long code block, such as if my cursor is on the def statement for a lengthy function, several lines get sent correctly, then some nonsense text eventually get sent to terminal instead of my actual code, and I get an error.

Steps to reproduce:

  1. In a .py file, define a function using the def statement. It should have a fair number of lines. In my case, 42 lines.
  2. With the cursor on the same line as the def statement, hit 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)

There is no output. It's blank.

Extension version: 2026.0.0
VS Code version: Code 1.109.3 (Universal) (b6a47e94e326b5c209d118cf0f994d6065585705, 2026-02-12T17:54:48.470Z)
OS version: Darwin arm64 25.3.0
Modes:

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


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
chatgpt ope 0.4.74
copilot-chat Git 0.37.6
csdevkit ms- 2.10.3
csharp ms- 2.120.3
debugpy ms- 2025.18.0
docker doc 0.18.0
js-debug ms- 1.105.0
js-debug-companion ms- 1.1.3
jupyter ms- 2025.9.1
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.3.0
parallels-desktop Par 1.5.11
powershell ms- 2025.4.0
python ms- 2026.0.0
quarto qua 1.129.0
r REd 2.8.6
r-syntax REd 0.1.3
rainbow-csv mec 3.24.1
remote-containers ms- 0.442.0
remote-wsl ms- 0.104.3
sort-lines Tyr 1.12.0
vscode-containers ms- 2.4.1
vscode-docker ms- 2.0.0
vscode-dotnet-runtime ms- 3.0.0
vscode-icalendar af4 1.0.1
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
vscode-pylance ms- 2025.10.4
vscode-python-envs ms- 1.16.0
vscode-xml red 0.29.0
System Info
Item Value
CPUs Apple M4 Pro (14 x 2400)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x106b [Google Inc. (Apple)], DEVICE=0x0000 [ANGLE (Apple, ANGLE Metal Renderer: Apple M4 Pro, Version 26.3 (Build 25D125))], DRIVER_VENDOR=Apple, DRIVER_VERSION=26.3 ACTIVE
Machine model name: Mac
Machine model version: 16.8
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
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 9, 8, 8
Memory (System) 48.00GB (0.07GB free)
Process Argv --crash-reporter-id 59c64e8e-dcb7-475e-bb77-fc0f062aecee
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
pythonvspyt551:31249599
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31436602
aj953862:31281341
6abeh943:31336334
cloudbuttont:31379625
aihoversummaries_t:31453032
3efgi100_wstrepl:31403338
use-responses-api:31390855
anonusage:31403420
je187915:31401257
ec5jj548:31422691
cmp-ext-treat:31426748
cp_cls_c_966_ss:31454199
ge8j1254_inline_auto_hint_haiku:31431912
nes-autoexp-10:31446583
a5gib710:31434435
00h15499_gpt_53_codex:31461825
rename_enabled:31436409
7a04d226_do_not_restore_last_panel_session:31438103
anthropic_thinking_c:31457102
406hc587_ask_agent:31428393
cp_cls_c_1081:31454833
copilot-nes-oct-trt:31432596
ia-use-proxy-models-svc:31452481
nes-slash-models-on:31441832
nes-set-to-on:31441941
a43f0575b:31442825
e9c30283:31461165
c0ci8992_validated:31449878
nes-fast-additive:31462050
control_6dc23131:31461115
edit_mode_hidden:31461530
showstats:31457174
864ei723_large_tool_results_to_disk:31460878
notips:31457203
reg-2ge67640:31455970
nes-extended-on:31455476
chat:31457767

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-neededNeeds assignment to the proper sub-team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions