vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Indent can not be aligned to the parenthsis for the functions with structure pointer return value

Open tenggui opened this issue 3 years ago • 3 comments

Type: Bug

Indent can not be aligned to the parenthsis for the functions with structure pointer return value, even if "C_Cpp.vcFormat.indent.withinParentheses" has been set to "alignToParenthesis". For the below example, the "enum ynr_slot_list_type type" should be aligned to the left parenthsis of "(uint8_t cam_id", but it is only indented with a tab. struct ynr_slot *ynr_peer_last_slot(uint8_t cam_id, enum ynr_slot_list_type type);

Extension version: 1.13.9 VS Code version: Code 1.74.3 (97dec172d3256f8ca4bfb2143f3f76b503ca0534, 2023-01-09T16:59:02.252Z) OS version: Windows_NT x64 10.0.19044 Modes: Sandboxed: No Remote OS version: Linux x64 5.13.0-51-generic Remote OS version: Linux x64 5.13.0-51-generic Connection to 'ssh-remote+10.106.35.200' could not be established

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (8 x 1992)
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.85GB (4.06GB free)
Process Argv --crash-reporter-id f8d5cbc7-a399-423b-a5bb-d7767774009e
Screen Reader no
VM 50%
Item Value
Remote SSH: 10.106.35.200
OS Linux x64 5.13.0-51-generic
CPUs Intel(R) Xeon(R) Silver 4314 CPU @ 2.40GHz (64 x 800)
Memory (System) 125.35GB (77.07GB free)
VM 0%
Item Value
Remote SSH: 10.106.35.200
OS Linux x64 5.13.0-51-generic
CPUs Intel(R) Xeon(R) Silver 4314 CPU @ 2.40GHz (64 x 800)
Memory (System) 125.35GB (77.07GB free)
VM 0%

Connection to 'ssh-remote+10.106.35.200' could not be established

A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931:30280409
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
pyindex848:30577860
nodejswelcome1cf:30587006
2e4cg342:30602488
89544117:30613380
fim-prod:30623723

tenggui avatar Jan 18 '23 02:01 tenggui

Hi @tenggui . Could you confirm if you have set the C_Cpp.formatting setting, and what it's set to?

By default, the C/C++ extension leverages clang-format for formatting, which can be configured with a .clang-format file. The C_Cpp.vcFormat.indent.withinParentheses setting you referred to is specific to when using vcFormat for formatting.

Colengms avatar Jan 18 '23 23:01 Colengms

Hi @tenggui . Could you confirm if you have set the C_Cpp.formatting setting, and what it's set to?

By default, the C/C++ extension leverages clang-format for formatting, which can be configured with a .clang-format file. The C_Cpp.vcFormat.indent.withinParentheses setting you referred to is specific to when using vcFormat for formatting.

My C_Cpp.formatting has already been set to vcFormat

tenggui avatar Jan 30 '23 06:01 tenggui

I've reported a bug on our shared VS formatting component at https://developercommunity.visualstudio.com/t/C-language-formatting-doesnt-work-corre/10272059 .

Using "C_Cpp.formatting": "clangFormat" is a workaround, but that uses a different formatting engine.

sean-mcmanus avatar Feb 06 '23 19:02 sean-mcmanus