Skip to content

editor.autoIndentOnPaste doesn't work if the initial line is already correctly indented #285222

@RedCMD

Description

@RedCMD

editor.autoIndentOnPaste doesn't work if the initial line is already correctly indented
if the initial line is incorrectly indented, editor.autoIndentOnPaste works as expected

Type: Bug

  1. enable setting editor.autoIndentOnPaste
    disable setting editor.formatOnPaste
"editor.autoIndentOnPaste": true,
"editor.formatOnPaste": false,
  1. create TypeScript file with snippet
{
	
}
  1. paste example code on the 2nd line (after the tab)
const a = 4;
const b = 4;
const c = 4;
const d = 4;
  1. notice incorrect indentation on lines 3-5 🐛
  2. repeat step 2
  3. add OR remove a tab from line 2
  4. repeat step 3
  5. notice correct indentation on all lines ✅

Expected:

{
	const a = 4;
	const b = 4;
	const c = 4;
	const d = 4;
}

Actual

{
	const a = 4;
const b = 4;
const c = 4;
const d = 4;
}

cc @aiday-mar

VS Code version: Code 1.107.1 (618725e, 2025-12-10T07:43:47.883Z)
OS version: Windows_NT x64 10.0.26200
Modes:

System Info
Item Value
CPUs AMD Ryzen 5 5600 6-Core Processor (12 x 3500)
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: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.93GB (16.48GB free)
Process Argv --crash-reporter-id 6787231e-58b0-4969-923e-74f4af57ddb2
Screen Reader no
VM 0%
Extensions (11)
Extension Author (truncated) Version
vscode-ignore Bre 3.0.1
tsup-problem-matchers lux 1.0.7
highlight-on-copy mgu 1.1.6
json-embedded-languages Red 0.3.3
regexp-syntax-highlighter Red 1.1.1
snippets-snippets Red 0.2.1
tmlanguage-syntax-highlighter Red 2.8.0
code-spell-checker str 4.4.0
native-preview Typ 0.20251227.1
paste-diff ufy 1.0.2
pretty-ts-errors Yoa 0.7.0
A/B Experiments
vsliv368cf:30146710
vswsl492cf:30256860
pythonvspyt551:31249599
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31436602
aj953862:31281341
nes-set-on:31351930
6abeh943:31336334
cloudbuttont:31379625
todos-1:31405332
3efgi100_wstrepl:31403338
use-responses-api:31390855
je187915:31407605
afag3459:31428711
ec5jj548:31422691
terminalsuggestenabled:31431119
cp_cls_c_966_ss:31435507
c0683394:31419495
478ah919:31426797
a5gib710:31434435
38bie571_auto:31426784
7a04d226_do_not_restore_last_panel_session:31438103
anthropic_thinking_t:31432745
p_e9cf0154:31434513
406hc587_ask_agent:31428393
cp_cls_t_1081:31433292

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions