Last I looked, nor does it handle the half-indent for private/protected/public in classes, { on newline iff the if is multilined, or even conditional {} based on number of statements in adjacent if/else blocks.
FWIW, I'm now all-in for adding a checkin script to run clang-format with --style=Mozilla on everything. I used to be pretty set on our own local patois. After 5 years at mozilla, I've spent far more time arguing about code style than it would have cost me to use a "sub-optimal" coding style. On Fri, May 6, 2016 at 8:43 AM, Jakob Stoklund Olesen <jole...@mozilla.com> wrote: > Hi, > > I’ve landed a js/src/.clang-format configuration file, so clang-format is > now more useful for SpiderMonkey code. Previously, it would pick up the > top-level .clang-format file which uses the standard Mozilla style. (I also > added a separate config for the VIXL snowflake.) > > The clang-format command line utility will reformat a whole source file > which is probably not what you want, but there are also editor integration > scripts. For Vim, I use: > > " Hook up clang-format to C-K. > map <C-K> :pyf /usr/local/share/clang/clang-format.py<cr> > imap <C-K> <c-o>:pyf /usr/local/share/clang/clang-format.py<cr> > > This reformats just the current line or selection with Ctrl-K. > > There is also a clang-format.el file with a lot of parentheses in it. It > looks like some kind of precursor to XML. I dunno, maybe poke at it? > > The 'git clang-format’ command can reformat just the lines that were > changed since a given commit. I am not aware of a Mercurial equivalent. > > Unfortunately, the way SpiderMonkey indents case labels is too odd for > clang-format. I don’t think it has a configuration flag that can do that > half-indent. (It does have the half-indent flag for > public/private/protected labels.) It’s on my todo list to add such an > option to clang-format, but I haven’t gotten around to it yet. In the > meantime, I use Vim’s ‘=‘ command to fix the indentation of case labels. > > Thanks, > /jakob > > _______________________________________________ > dev-tech-js-engine-internals mailing list > dev-tech-js-engine-internals@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals > _______________________________________________ dev-tech-js-engine-internals mailing list dev-tech-js-engine-internals@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals