vscode-clang-format icon indicating copy to clipboard operation
vscode-clang-format copied to clipboard

Different styles for each save

Open xgdgsc opened this issue 5 years ago • 2 comments

Everytime I save a cpp file, some certain small parts of the file would repeatedly be changed space. like the

 public:
public:

would add this space in one run and remove in another run. So I get unclear commits. What could be the reason?

xgdgsc avatar Apr 03 '19 08:04 xgdgsc

      if (count > LEVELS - 1) break;
      if (count > LEVELS - 1)
        break;

Another example it would move the break to one line or 2 lines back and forth.

xgdgsc avatar Apr 03 '19 08:04 xgdgsc

I have a similar problem using c. When using BasedOnStyle: Google It keeps switching between:

#include "test.h"

#include <string.h>

void main() {}

and

#include "test.h"

#include <string.h>


void main() {}

This holds for many files, although I have noticed this only occurs when I have more than 1 grouping of headers. It even occurs with changes to the style:

BasedOnStyle: Google
IndentWidth: 4
UseTab: Always
TabWidth: 4
AllowShortIfStatementsOnASingleLine: Always
ColumnLimit: 140
AccessModifierOffset: -4
ConstructorInitializerAllOnOneLineOrOnePerLine: false
DerivePointerAlignment: false
IncludeCategories:
  - Regex:           '^<.*'
    Priority:        2
  - Regex:           '.*'
    Priority:        1

---
Language: Cpp
AllowShortFunctionsOnASingleLine: All

EDIT: Interestingly, it also does not happen when a macro definition is inserted in between a group of 2.

HuskyNator avatar Nov 15 '20 13:11 HuskyNator