-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format on save takes way too long with cmake extension enabled. #12221
Comments
@christianbrugger Thanks for posting this issue. I believe this is actually a bug on the cpptools extension, which is a dependency of ours (see #6809). @sean-mcmanus @bobbrow @Colengms Could you transfer this to the cpptools extension? |
@christianbrugger What is your "editor.formatOnSaveMode"? |
@sean-mcmanus "editor.formatOnSaveMode" is set to "file" |
@christianbrugger What version of the C/C++ extension are you using? Also, with |
@christianbrugger My guess is you're hitting a combination of #6156 and #12169 . You'd see logging like
|
@sean-mcmanus I am using C/C++ version When enabling
formatting-file-log.webmTo me it looks like formatting is sometimes blocked until IntelliSense is done, leading to large delays. Formatting does not depend on IntelliSense so this could be resolved by better scheduling of those tasks. Issue #6156 speaks about the same problem in a the context of on-type formatting, where similar delays are reported. In that way it is similar. One suggested fix was to make on-type formatting not depend on file formatting and use a simpler, e.g. Python based, method. Such a fix would not help here. Issue #12169 is about the time of IntelliSense being too large in general, not using multiple threads and lacking caching. I think it is only remotely related. While a speedup would make the lags less, the issue here seems to be related to both formatting and IntelliSense competing sometimes, not the time of IntelliSense itself. |
This is a duplicate of #6156 -- I've updated the title to not mention "on type" formatting, since the root issue occurs for all formatting. The formatting is stuck behind a 22 second IntelliSense update: |
Brief Issue Summary
When using format on save
"editor.formatOnSave": true
withCMake Tools
extension enabled the save often takes 10 seconds or even longer. For the formatting itself I am usingclang-format-17
.Slow.-.CMake.Extension.Enabled.webm
Running
clang-format-17
itself takes 20ms on this file when launched from the terminal.The text was updated successfully, but these errors were encountered: