Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
Qt Creator 4.8.0-rc1
-
None
Description
Steps to reproduce:
- set QTC_FORMAT_INSTEAD_OF_INDENT environment variable to 1
- enable ClangFormat (experimental) plugin
- restart Qt Creator
- use code sample
#include <string> #include <iostream> using std::string;using std::endl;using std::cout; int main(int,char*[]){cout<<string("hello, world")<<endl;return 0;}
- create .clang-format inside project directory
BasedOnStyle: Google AccessModifierOffset: -4 AlignAfterOpenBracket: Align AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false BraceWrapping: AfterClass: true AfterControlStatement: true AfterEnum: true AfterFunction: true AfterNamespace: false AfterStruct: true AfterUnion: true AfterExternBlock: true BeforeCatch: true BeforeElse: true SplitEmptyFunction: false SplitEmptyRecord: true SplitEmptyNamespace: true BreakBeforeBraces: Custom BreakConstructorInitializers: BeforeColon ColumnLimit: 90 ConstructorInitializerAllOnOneLineOrOnePerLine: false ContinuationIndentWidth: 8 DerivePointerAlignment: false IndentCaseLabels: false IndentWidth: 4 SpacesBeforeTrailingComments: 1 Standard: Cpp11
- select all (Crtl+A)
- auto-indent selection (Ctrl+I)
Expected result:
#include <iostream> #include <string> using std::cout; using std::endl; using std::string; int main(int, char*[]) { cout << string("hello, world") << endl; return 0; }
Actual result:
#include <string> // [ISSUE] not sorted #include <iostream> using std::cout; // [OK] sorted using std::endl; using std::string; int main(int, char*[]) // [OK] reformatted { cout << string("hello, world") << endl; return 0; }