如何用clang-format文件提供Visual Studio Clang-Format插件? [英] How to feed Visual Studio Clang-Format plugin with clang-format file?
问题描述
因此,我下载,安装并插入了clang格式插件.我也对其进行了测试,它可以直接用于Google(Mozilla等)格式设置选项,但是我无法将其与.clang格式文件一起使用. (我已将文件与源文件放在同一文件夹中,将其编码更改为UTF-8,还尝试将其放入clang安装文件夹,将文件添加到项目中,将其内容写入'{key:value}'
内,但格式未设置发生).那么,如何将格式设置文件提供给chrome格式的扩展名呢?
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, yet I cannot get it working with my .clang-format file. (I've put my file into the same folder as my source file, changed its encoding into UTF-8, also tried to put it into clang install folder, add file into project, write its contents inside '{key:value}'
yet formatting does not happen). So how do you feed formatting file to chrome-format extension?
我的文件内容:
{ BasedOnStyle: "LLVM", IndentWidth: 4 }
我的文件名:nm.clang-format
推荐答案
转到工具"->选项"->"LLVM/Clang"->"ClangFormat",然后将file
放在样式"选项字段中.
Go to Tools->Options->LLVM/Clang->ClangFormat and put file
in the Style option field.
然后将名为.clang-format
的样式文件(这是完整文件名,而不是扩展名)放置在源文件的目录或其父目录之一中. Windows资源管理器不允许您使用前导.
创建文件名,因此您需要转到控制台.
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.
这篇关于如何用clang-format文件提供Visual Studio Clang-Format插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!