Skip to content

Run selection/line in python terminal seems to fail if selected too many characters #25741

@alexanderpils

Description

@alexanderpils

Type: Bug

Behaviour

On my MacBook when I select more than around 1100 characters the parsing of the selection is failing and causing then an syntax error when executed in the terminal.

Steps to reproduce:

  1. Select more than 1100 characters with some indentations like functions, classes, loops,...

  2. Then press shift + enter (Python: Run selection/Line in Python Terminal)

  3. Now the data gets parsed wrong and is causing an Error.

screenrecording.mov

Diagnostic data

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

XXX

Extension version: 2026.0.0
VS Code version: Code 1.108.1 (Universal) (585eba7c0c34fd6b30faac7c62a42050bfbc0086, 2026-01-14T14:55:44.241Z)
OS version: Darwin arm64 25.2.0
Modes:

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


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
autodocstring njp 0.6.1
copilot-chat Git 0.36.1
debugpy ms- 2025.18.0
echoapi-for-vscode Ech 1.7.13
gitlens eam 17.9.0
isort ms- 2025.0.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
LiveServer rit 5.7.9
material-icon-theme PKi 5.30.0
python ms- 2026.0.0
rainbow-csv mec 3.24.1
ruff cha 2026.34.0
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
vsliveshare ms- 1.0.5959
vsliveshare-pack ms- 0.4.0
System Info
Item Value
CPUs Apple M1 Pro (8 x 2400)
GPU Status 2d_canvas: enabled
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: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 2, 3, 4
Memory (System) 16.00GB (0.36GB free)
Process Argv --crash-reporter-id 6c7f7e46-e60f-4b2b-9859-c46c2fc707c1
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
pythonvspyt551cf:31249601
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31436602
aj953862:31281341
63221493:31336333
cloudbuttont:31379625
42190218_ostrepl:31403339
use-responses-api:31390855
ec5jj548:31422691
cmp-ext-treat:31426748
cp_cls_c_966_ss:31446431
c0683394:31419495
nes-autoexp-off:31446584
a5gib710:31434435
rename_enabled:31436409
7a04d226_do_not_restore_last_panel_session:31438103
anthropic_thinking_t:31432745
cp_cls_c_1081:31443829
copilot-nes-oct-trt:31432596
nes-jump-on-with-edit:31447383
nes-slash-models-on:31441832
nes-set-to-on:31441941
a43f0576c:31442824
ts_provider_disabled:31446105
nes-conv-1-2:31447851

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