5

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?

Gama11
  • 31,714
  • 9
  • 78
  • 100
Yu Liu
  • 51
  • 1
  • 3

2 Answers2

3

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

Shubham Garg
  • 971
  • 8
  • 18
0

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.

krazyk4tlady
  • 389
  • 1
  • 5
  • 13