How to feed Visual Studio Clang-Format plugin with clang-format file?

前端 未结 4 1049
难免孤独
难免孤独 2021-01-01 10:54

So I downloaded, installed, and inserted into path the clang formatting plugin. I also tested it and it works for Google (Mozilla, etc.) formatting options out of the box, y

相关标签:
4条回答
  • 2021-01-01 11:38

    If like me you got confused later on where the .clang-format was living, use procmon to track the file reads of clang-format.exe

    0 讨论(0)
  • 2021-01-01 11:48

    In VS2019 works if the clang-format file is named as .clang-format.

    It must be .clang-format, not .clang-format.txt or clang-format.txt.

    0 讨论(0)
  • 2021-01-01 11:49

    For the record, it seems that if both "Fallback Style" and "Style" are set to "file", no formatting will happen even if the style file is at its correct location. Setting "Fallback Style" to something different than "file" (e.g. "none") helps.

    0 讨论(0)
  • 2021-01-01 11:53

    Go to Tools->Options->LLVM/Clang->ClangFormat and put file in the Style option field.

    Then place your style file named .clang-format (this is the full filename, not an extension) either in the source file's directory or one of its parent directories. Windows Explorer won't let you create filenames with leading . so you need to go to the console for this.

    0 讨论(0)
提交回复
热议问题