c++ - How can I apply only one clang-format action? -


i want use clang-format align comments, nothing else.

the option is: aligntrailingcomments (bool).

but when run following:

clang-format-3.6 -i -style='{aligntrailingcomments: true}' <file> 

it performs kinds of other formatting options suppose have default when unspecified.

how can execute 1 clang formatting rule on codebase?

having of these defaults make difficult see full effect single formatting option has on code. have parse through diff of these other changes , decide if option specified did it.


i noticed there disableformat option, no matter how use it, stops formatting happening @ all.

clang-format-3.6 -i -style='{aligntrailingcomments: true, disableformat: true}'  clang-format-3.6 -i -style='{disableformat: true, aligntrailingcomments: true}' 

both cause clang-format not make code anywhere.

i think clang format not designed this. rules not things applies incrementally, program instead built around, parsing entire program , forgetting (most of) old whitespace, , generating new whitespace based on rules select.

you can see overview of architecture here: http://www.llvm.org/devmtg/2013-04/jasper-slides.pdf

first runs clang lexer , parser, divides groups of tokens "unwrapped lines" "tokens put on single line if there no column limit". layouter determines formatting of each unwrapped line based on various constraints , optimizing various penalties.

so, don't think "one clang-format action" thing, design looks pretty monolithic me.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -