[cfe-users] Visual Studio clang-format extension difficulties

Hans Wennborg hans at chromium.org
Mon Sep 9 13:34:38 PDT 2013

I think a good idea might be to allow calling these files
"_clang-format", similar to how Vim's ".vimrc" files are called
"_vimrc" on Windows.

I sent out a patch for that: http://llvm-reviews.chandlerc.com/D1629,
let's see how it goes.

 - Hans

On Sun, Sep 8, 2013 at 9:17 AM, Michael Price
<michael.b.price.dev at gmail.com> wrote:
> Alright, I figured it out.
> The name of the file literally has to be ".clang-format".  A file that has
> an extension of ".clang-format" is not good enough.  IMO, the documentation
> should either be made more clear, or we should allows that form of filename.
> On Windows, it is not obvious how to create a file that "has no filename,
> only an 'extension'".  In fact, Explorer freaks out and won't let you do it,
> you have to do it from the command-line or some application.  If I don't get
> any hits on this list, I'll forward over to the cfe-dev list.
> On Sat, Sep 7, 2013 at 7:58 PM, Michael Price
> <michael.b.price.dev at gmail.com> wrote:
>> FWIW, when I run clang-format directly when in the directory with the
>> source code, I get this message at the top of the output:
>> Can't find usable .clang-format, using LLVM style
>> On Sat, Sep 7, 2013 at 7:06 PM, Michael Price
>> <michael.b.price.dev at gmail.com> wrote:
>>> The guidance for how to use the "File" configuration for the options is
>>> not clear.
>>> I've put a .clang-format file in the same directory as the source code,
>>> but it doesn't seem to be picking up those settings.  Does anyone have an
>>> example of how this is supposed to work?
>>> They guidance provided by the plugin (in the Visual Studio options dialog
>>> for the extension) gives an example for the content of the YAML file along
>>> the lines of
>>> '{BasedOnStyle: "LLVM", IndentWidth:8}'
>>> But this exact string doesn't seem to work, neither does removing the
>>> outer quotes, nor the curly braces, nor the commas (which is the format that
>>> clang-format -dump-config prints out).

More information about the cfe-users mailing list