cancel
Showing results for 
Search instead for 
Did you mean: 

Solved: Code formatting stops working after disabling Microsoft C/C++ extension

j9-ok
Associate
Hi everyone,
I found a solution for a common issue when using the official STM32Cube for VS Code extension. If you disable the Microsoft C/C++ (ms-vscode.cpptools) extension to avoid IntelliSense conflicts, you might notice that "Format Document" stops working completely.
The reason is that the STM32 extension's built-in clangd has its formatting engine disabled by default.
To fix this:
  1. Go to VS Code Settings (Ctrl + ,).
  2. Search for: stm32cube-ide-clangd.enableFormatting.
  3. Check the box to enable it.
  4. If prompted, set "STM32Cube for VS Code" as your Default Formatter.
This allows you to have working formatting and precise IntelliSense without any conflicts from the Microsoft extension. Hope this helps!
 

1 REPLY 1
Cartu38 OpenDev
Lead III

@j9-ok 
Cannot claim to fix ... as not a bug but a feature.
See https://community.st.com/t5/stm32cubeide-for-visual-studio/what-s-the-recommended-cli-environment-variable-path-after-vs/td-p/885901
Disabling formating by default has been asked by this community ....