Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Beautify c++ files on VSCode

I am using VSCode 1.35.5.

I have two projects in the workspace, one .js files and another with .cpp files.

When I want to beautify a .cpp file, here is the following pop up :

enter image description here

From File -> Preferences -> Extensions, here are the following enabled extensions :

  • Beautify from HookyQR 1.5.0
  • C/C++ from Microsoft 0.23.1
  • CMake 0.0.17
  • ESLint 1.9.0

How can I use the Beautify extension for C++ files ?

like image 738
user7364588 Avatar asked Dec 23 '22 22:12

user7364588


2 Answers

  • Open "Show Command Palette" with F1 or CMD + Shift + P, then write "Format Document With..." then select c/c++ selection.
  • Or first select "default" then select "c/c++". In second way when you press Alt+Shift+F, you can format your C++ file.
like image 185
Gorkem Sevim Avatar answered Apr 06 '23 10:04

Gorkem Sevim


  • Simple go to command palette using Ctrl+Shift+P
  • search "format"
  • and select "Format document with"
  • and simply select "C/C++"

No need for any third party formatter. And if you want to use them then just go to this link and follow the steps: Description to install clang-formatter

And while installing clang make sure to add a path to current user or to all users after installing both the clang software and the extension in VSCode. The use is same as I mention for default C/C++ formatter.

like image 45
Muhammad Hamza Avatar answered Apr 06 '23 10:04

Muhammad Hamza