I want to use ctrl+K ctrl+F in vscode to auto align my .cpp codes, but it doesn't work with hint "there is no selection formatter for 'cpp'-files installed", however, when I copy the code to Formatting part of Interactive Playground in vscode, it works. why? that's strange?
2 Answers
try using
shift+alt+f
If it does not work Install Prettier format extension and set default formatter If still not work use Clang Formatter
Comments
You need to install a beautifier extension that supports cpp. The best I've found is this: https://code.visualstudio.com/docs/languages/cpp Ctrl-Shift-X brings you to extensions, search for "beautify c++" and select "C/C++ 0.20.1" from the result list.
shift+alt+f, althoughclang-formatis installed viabrew(and you can run it from the terminal inside VScode), and the Microsoft C/C++ extension is installed. VSCode website says the extension comes with clang-format support. But no. And on clicking "install formatters" it lists the corresponding extensions: the C/C++ is at the top (and already installed), thenclangd, etc.intelliSenseEnginesetting of the C/C++ extension was simply set to disabled.