Sourcecode auto formatter error

CodeLite installation/troubleshooting forum
Ashmon
CodeLite Curious
Posts: 8
Joined: Thu Mar 23, 2017 8:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Sourcecode auto formatter error

Post by Ashmon »

When I hit CTRL + I (autoformat sourcecode), all code is deleted and replaced with:


1 konnte nicht gefunden werden.
2


This is german and translates to "was not found". I just reinstalled Windows and don't have a clue, what I did wrong this time! I'm also confused why it is shown in german, when everything else is in English.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Sourcecode auto formatter error

Post by eranif »

1. Which version of CodeLite are you using?
2. Enable the log file of CodeLite from: Settings->Misc->Log->Log verbosity, and set it to DEBUG

Try to format a file and copy the log file content from %appdata%\CodeLite\codelite.log to this thread (try to locate the relevant parts only)
Make sure you have read the HOW TO POST thread
Ashmon
CodeLite Curious
Posts: 8
Joined: Thu Mar 23, 2017 8:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Sourcecode auto formatter error

Post by Ashmon »

I'm using 10.0.3 (latest stable)


I deleted the content of the logfile. This is right after trying to autoformat:

[19:05:09:363 DBG] ContinuousBuild::OnFileSaved
[19:05:09:363 DBG] ContinuousBuild is disabled
[19:05:10:807 DBG] No EditorConfig file found for file: D:\Mega Sync\Benutzer\Ashmon\Documents\Programmieren\Schroedinger\Schroedinger\Strings\main.cpp
[19:05:14:519 DBG] Formatting file: ' D:\Mega Sync\Benutzer\Ashmon\Documents\Programmieren\Schroedinger\Schroedinger\Strings\main.cpp '
[19:05:14:523 DBG] Using C++/Clang formatter
[19:05:14:530 DBG] CodeForamtter: C:\Windows\system32\cmd.exe /C "C:\Program Files\CodeLite\codelite-clang-format.exe" -style="{ BasedOnStyle: WebKit, IndentWidth: 4, UseTab: Never, Language : Cpp , AlignEscapedNewlinesLeft: true, AlignTrailingComments : true, AllowAllParametersOfDeclarationOnNextLine : false, AllowShortFunctionsOnASingleLine : false, AllowShortBlocksOnASingleLine : false, AllowShortLoopsOnASingleLine : false, AllowShortIfStatementsOnASingleLine : false, AlwaysBreakBeforeMultilineStrings : false, AlwaysBreakTemplateDeclarations : false, BinPackParameters : false, BreakBeforeBinaryOperators : false, BreakBeforeTernaryOperators : false, BreakConstructorInitializersBeforeComma : true, IndentCaseLabels : false, IndentFunctionDeclarationAfterType : false, SpaceBeforeAssignmentOperators : true, SpaceBeforeParens : Never, SpacesInParentheses : false, BreakBeforeBraces : Linux, ColumnLimit : 120, PointerAlignment : Left }" -cursor=367 "D:\Mega Sync\Benutzer\Ashmon\Documents\Programmieren\Schroedinger\Schroedinger\Strings\.code-formatter-tmp.cpp"
[19:05:14:583 DBG] Done
[19:05:14:592 DBG] Formatting file: ' D:\Mega Sync\Benutzer\Ashmon\Documents\Programmieren\Schroedinger\Schroedinger\Strings\main.cpp '...is done
[19:05:16:438 DBG] No EditorConfig file found for file: C:\Users\ashmo\AppData\Roaming\codelite\codelite.log
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Sourcecode auto formatter error

Post by eranif »

when you run this command from a CMD shell, what is the result that you get:

Code: Select all

C:\Windows\system32\cmd.exe /C "C:\Program Files\CodeLite\codelite-clang-format.exe" -style="{ BasedOnStyle: WebKit, IndentWidth: 4, UseTab: Never, Language : Cpp , AlignEscapedNewlinesLeft: true, AlignTrailingComments : true, AllowAllParametersOfDeclarationOnNextLine : false, AllowShortFunctionsOnASingleLine : false, AllowShortBlocksOnASingleLine : false, AllowShortLoopsOnASingleLine : false, AllowShortIfStatementsOnASingleLine : false, AlwaysBreakBeforeMultilineStrings : false, AlwaysBreakTemplateDeclarations : false, BinPackParameters : false, BreakBeforeBinaryOperators : false, BreakBeforeTernaryOperators : false, BreakConstructorInitializersBeforeComma : true, IndentCaseLabels : false, IndentFunctionDeclarationAfterType : false, SpaceBeforeAssignmentOperators : true, SpaceBeforeParens : Never, SpacesInParentheses : false, BreakBeforeBraces : Linux, ColumnLimit : 120, PointerAlignment : Left }" -cursor=367 "D:\Mega Sync\Benutzer\Ashmon\Documents\Programmieren\Schroedinger\Schroedinger\Strings\YOUR-FILE.cpp"
Replace "YOUR-FILE" with the actual file you want to format and see what happens

Thanks
Make sure you have read the HOW TO POST thread
Ashmon
CodeLite Curious
Posts: 8
Joined: Thu Mar 23, 2017 8:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Sourcecode auto formatter error

Post by Ashmon »

It works as expected. This is my Cli:
(don't laugh about the code, it's from an educational book for practice....:-))



C:\Program Files\CodeLite>codelite-clang-format.exe -style="{ BasedOnStyle: WebKit, IndentWidth: 4, UseTab: Never, Language : Cpp , AlignEscapedNewlinesLeft: true, AlignTrailingComments : true, AllowAllParametersOfDeclarationOnNextLine : false, AllowShortFunctionsOnASingleLine : false, AllowShortBlocksOnASingleLine : false, AllowShortLoopsOnASingleLine : false, AllowShortIfStatementsOnASingleLine : false, AlwaysBreakBeforeMultilineStrings : false, AlwaysBreakTemplateDeclarations : false, BinPackParameters : false, BreakBeforeBinaryOperators : false, BreakBeforeTernaryOperators : false, BreakConstructorInitializersBeforeComma : true, IndentCaseLabels : false, IndentFunctionDeclarationAfterType : false, SpaceBeforeAssignmentOperators : true, SpaceBeforeParens : Never, SpacesInParentheses : false, BreakBeforeBraces : Linux, ColumnLimit : 120, PointerAlignment : Left }" -cursor=367 "D:\Mega Sync\Benutzer\Ashmon\Documents\Programmieren\Schroedinger\Schroedinger\Strings\main.cpp
{ "Cursor": 382, "IncompleteFormat": false }
#include <iostream>
#include <string>
using namespace std;

int main()
{

string einString01;
string einString02 = "Voll einfach";
einString01 = einString02;
string einString03;
getline(cin, einString03);
cout << einString03 << endl;
char zearray[] = "Ze-Array2String";
string einString04 = zearray;
string einString05(10, '+');
}
C:\Program Files\CodeLite>

the code between the curly brackets is moved back to the left corner by the forum. However, I get the expected result.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Sourcecode auto formatter error

Post by eranif »

Can you please set this environment variable in CodeLite: Settings->Environment variables

Code: Select all

LC_ALL=C
And try to format the file again, does the message still appears in German? Does it work now?

Eran
Make sure you have read the HOW TO POST thread
Ashmon
CodeLite Curious
Posts: 8
Joined: Thu Mar 23, 2017 8:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Sourcecode auto formatter error

Post by Ashmon »

Still the same problem.


I have only a default set and it now looks like this:

CodeLiteDir=C:\Program Files\CodeLite
LC_ALL=C



Reinstalling Codelite didn't help either.
Ashmon
CodeLite Curious
Posts: 8
Joined: Thu Mar 23, 2017 8:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Sourcecode auto formatter error

Post by Ashmon »

By the way, compiling programs is working.
Ashmon
CodeLite Curious
Posts: 8
Joined: Thu Mar 23, 2017 8:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Sourcecode auto formatter error

Post by Ashmon »

Ok, I found something: If I switch the formatter from clang-format to AStyle, it's working!
Post Reply