Repository navigation
Closed
Labels
Feature: Code FormattingLanguage ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.investigate: reproThis issue's repro steps needs to be investigated/confirmedThis issue's repro steps needs to be investigated/confirmedperformance
Milestone
Description
Type: Bug
Formatting any simple 60-line C++ file is sometimes instant, sometimes so long that I give up and try again. I've seen it take 20 seconds or more.
This doesn't depend on contents; formatting randomly takes a long or short time when doing minor changes in the same small .cpp file.
Extension version: 1.19.6
VS Code version: Code 1.87.0 (Universal) (019f4d1419fbc8219a181fab7892ebccf7ee29a2, 2024-02-27T23:42:56.944Z)
OS version: Darwin arm64 23.2.0
Modes:
Remote OS version: Windows_NT x64 10.0.22631
System Info
| Item | Value |
|---|---|
| CPUs | Apple M1 (8 x 24) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on 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 video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled webgpu: enabled |
| Load (avg) | 2, 2, 3 |
| Memory (System) | 16.00GB (0.08GB free) |
| Process Argv | --crash-reporter-id 177e6a93-bd0d-4e86-b1ce-b463c9692a68 |
| Screen Reader | no |
| VM | 0% |
| Item | Value |
|---|---|
| Remote | pc1 |
| OS | Windows_NT x64 10.0.22631 |
| CPUs | AMD Ryzen 9 5900X 12-Core Processor (24 x 3700) |
| Memory (System) | 63.93GB (36.37GB free) |
| VM | 0% |
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
pydisww1:30981707
cppperfcontrol:30979541
d34g3935:30971562
fegfb526:30981948
bg6jg535:30979843
ccp1r3:30958155
dsvsc020:30976470
Reacted by blackworm27, heartacker and Delgan
Metadata
Metadata
Assignees
Labels
Feature: Code FormattingLanguage ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.investigate: reproThis issue's repro steps needs to be investigated/confirmedThis issue's repro steps needs to be investigated/confirmedperformance
Type
Projects
- StatusShow more project fieldsDone
Activity
sean-mcmanus commentedon Mar 8, 2024
This is caused by the formatting task getting stuck behind a long IntelliSense parsing operation. It's being tracked by #6156 already, although that issue mentions format on type and vcFormat, the same issue would repro with clang-format and not on type.
...unless you don't see the C/C++ task bar progress indicator showing "IntelliSense: Updating" (and/or cpptools-srv isn't using CPU).
ArnoGW1 commentedon Mar 11, 2024
I don't see this indicator. The problem happens no matter which IntelliSense operations are underway. If I wait for the open file to be fully parsed and for VSCode to do nothing, then save, the save operation can still hang for a long time.
sean-mcmanus commentedon Mar 11, 2024
Arno Gobbin (@ArnoGW1) Can you set C_Cpp.loggingLevel to "Debug" and look in the C/C++ logging to see what it shows when your format and the bug repros?
e.g. normally, you should see something like
but if there are other messages then those could be contributing to the issue.
romanholidaypancakes commentedon Mar 12, 2024
I also encountered this problem. I have been worried about the performance issues of vs (api components and the like), because as far as I know, we only need to call the
clang-formatexecutable file to format the source code. If this is the case The technical solution should be optimized very soon!Formatting using visual studio only takes a moment (also clang-format), and if there are syntax errors in the code, it will take a long time and fail.
ArnoGW1 commentedon Mar 12, 2024
Copying a bit more than what you asked; this was with
formatOnSaveand saving took around 4 seconds in a 116-line file:Note that my settings contain:
But I remember having that issue before adding
formatOnSaveMode.ArnoGW1 commentedon Mar 12, 2024
Note that it sometimes doesn't finish at all. It's been happening a lot lately, which is blocking. Here's the log:
11 remaining items
daniellivingston commentedon Apr 8, 2025
This is something I'm running into as well. Curiously this is the only discussion I could find online referencing it. The Clang-Format extension outputs
error: offset 2530 is outside the file.Setting C_Cpp.loggingLevel to "Debug" shows:
Colengms commentedon Sep 18, 2026
We've been using this issue to track handling of multi-range format requests. It's unclear to me whether all related issues mentioned here have been addressed. It's possible there was a VS Code bug at some point that was generating excessive individual format requests, which may have since been resolved. If anyone is still repro'ing behavior they had reported here, please open a new issue with repro steps.
sean-mcmanus commentedon Sep 22, 2026
Arno Gobbin (@ArnoGW1) Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.35.2
ArnoGW1 commentedon Sep 23, 2026
Thank you! I will check this when I work on C++ stuff again.