clang-format-editor
clang-format-editor copied to clipboard
tabsize in style detector
Is it possible to change the default tabsize (8) to an other value. My sources use a tabsize of 4 and I can't get a usable result.
This drives me crazy! I cloned the code got it compiled but can't find where the tab size is set to 8. The Tabs of my source are interpreted as 8 (should be 4) so the rest goes totally wrong.
Hi @woko54,
Sorry for delay response, can you give me a text file, to reproduce your problem?
Kind regards, Marina
DRV8825.txt Thanks for answering. Here is a cpp source file I used for testing. Tabsize is 4.
It seems like your detection result is closer to LLVM
style, TabWitdth = 8
is the default value specific for LLVM. If you want, you can adjust TabWitdth value from our Style Detector, and generate a clang-format file
What do you mean by "the rest goes totally wrong"? Let me know if is something unclear, or if I didn't answer completely to your question
Kind regards, Marina
The style should be "Microsoft", it will be the best match. I think the wrong tabsize is the cause for the wrong style. The tabsize should be set before the detection starts.
We have applied format (default styles: Mozila, LLVM ...) on file and selected the smallest Levenshtein distance value, that is more closer to your file (seems to be LLVM in this case), the result can be influenced by another values too
Depends which algorithm you use to find the best match
In this case I don't see how setting a tab before detection will help, I need more information to understand this idea
It was only a guess, to explain the (for my opinion) wrong style detection.
When the detector has completed the sample (above), I see Tabs used in the left window with a size of 8, no tabs and an indention of 2 in the right (result) window. It does not look like it should do.