Search code examples
c++visual-studio-codeautoformatting

Auto formatter changes > > to >>


I'm having a problem with the C++ extension of VScode. Whenever I define a matrix consisting of vectors like vector<vector<int> > and use the auto formatter, it changes the code to vector<vector<int>> which results in a compiler error.

Is there any solution to this?


Solution

  • The VSCode C++ extension uses clang-format for formatting the document. If you are stuck with an old compiler which doesn't support C++11, just add a .clang-format file in your workspace with following line:

    Standard : Cpp03
    

    For more formatting options, refer to the following link: https://clang.llvm.org/docs/ClangFormatStyleOptions.html