Skip to content

Format braces on new line causes editor to scroll so that the top of the editor is at the opening brace #10626

@lachy874125

Description

@lachy874125

Type: Bug

  1. Set user settings.json to:
{
    "editor.formatOnType": true,
    "C_Cpp.formatting": "vcFormat",
    "C_Cpp.vcFormat.newLine.beforeOpenBrace.function": "newLine"
}
  1. Create a new file with a .cpp extension.
  2. Type int main(){ and press enter.
  3. The program puts the opening curly brace on a new line as expected but then it scrolls so that the topmost line is the one with the curly bracket. So I am not able to see int main(). I do not want it to auto-scroll to the opening brace. The same thing happens if I set the newLine setting for braces of blocks, namespaces, etc. I have tested this on two machines both with the same behaviour. My workspace settings.json is empty. Haven't been able to find anything online regarding this.

Extension version: 1.14.4
VS Code version: Code 1.76.0 (92da9481c0904c6adfe372c12da3b7748d74bdcb, 2023-03-01T10:22:44.506Z)
OS version: Windows_NT x64 10.0.19044
Modes:
Sandboxed: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz (12 x 2712)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
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_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 31.64GB (17.16GB free)
Process Argv --crash-reporter-id 524ecb80-51b5-4f1d-baae-d494b2552e56
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewvextcfv2:30669238
azure-dev_surveyone:30548225
pyindex848:30662994
nodejswelcome1cf:30587006
3biah626:30602489
pyind779:30671433
f6dab269:30613381
vscrp:30673768
pythonsymbol12:30671437
6233i204:30672705
vsccsb:30662443
funwalk2cf:30676044

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions