Page 1 of 2
Format current sourcode: operable program or batch file
Posted: Tue May 30, 2017 2:49 pm
by hptphuong
Hi all,
I tried to use "Format current sourcode".
But when I select my code and choose this function, it delete all my code and appear this line"operable program or batch file."
Anyone know what is my issue, May be i miss some setup or wrong in operate.
Please help me fix this issue.(I'm using windown 10 with newest version of codelite 10.0.4)
Thanks & Best Regards,
Phuong Hoang
Re: Format current sourcode: operable program or batch file
Posted: Tue May 30, 2017 5:58 pm
by eranif
Please enable CodeLite log and post the log output here.
To enable the log: settings->preferences->misc->log->codelite log level->Debug
The log file can be seen under: %appdata%\CodeLite\codelite.log
Re: Format current sourcode: operable program or batch file
Posted: Tue May 30, 2017 6:47 pm
by AJenbo
It would also be nice to know if this is for php or c++ and what formatter you have selected under options.
The error you are getting means that windows was not able to locate the formatting tool, so my best guess is that you didn't set the "clang-format path" for c++ or PHP Executable if you are trying to format php.
Re: Format current sourcode: operable program or batch file
Posted: Tue May 30, 2017 9:12 pm
by hptphuong
@eranif: There is my log:
Code: Select all
[00:06:50:698 DBG] Formatting file: ' C:\Users\hptphuong\Documents\Self C++\learning\first\main_app.cpp '
[00:06:50:698 DBG] Using C++/Clang formatter
[00:06:50:714 DBG] CodeForamtter: C:\Windows\system32\cmd.exe /C "C:\Program Files\CodeLite\codelite-clang-format.exe" -assume-filename=main_app.cpp -style="{ BasedOnStyle: WebKit, IndentWidth: 4, UseTab: ForIndentation, 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 : true, IndentFunctionDeclarationAfterType : true, SpaceBeforeAssignmentOperators : true, SpaceBeforeParens : Never, SpacesInParentheses : false, BreakBeforeBraces : Linux, ColumnLimit : 120, PointerAlignment : Left }" -cursor=0 -offset=0 -length=508 "C:\Users\hptphuong\Documents\Self C++\learning\first\.code-formatter-tmp.cpp"
[00:06:50:808 DBG] Done
[00:06:50:823 DBG] Formatting file: ' C:\Users\hptphuong\Documents\Self C++\learning\first\main_app.cpp '...is done
[00:06:51:886 DBG] No EditorConfig file found for file: C:\Users\hptphuong\AppData\Roaming\codelite\codelite.log
[00:06:54:911 DBG] No EditorConfig file found for file: C:\Users\hptphuong\Documents\Self C++\learning\first\main_app.cpp
Please help me find what is the issue?
@Ajenbo: I'm working on C++. Please help me to set "clang-format path" for c+
Re: Format current sourcode: operable program or batch file
Posted: Tue May 30, 2017 9:36 pm
by eranif
can you try and execute the command from the command line?
Re: Format current sourcode: operable program or batch file
Posted: Tue May 30, 2017 10:28 pm
by hptphuong
@eranif: Please let me know how to do it? one more, it's ridiculous to reindent by code. It's inconvenient. In sublime, i can make it easy with hot key.
Re: Format current sourcode: operable program or batch file
Posted: Tue May 30, 2017 10:43 pm
by eranif
it is also done by hot key in codelite (ctrl-i). it works everywhere, except for you
i wanted you to try and run it from the command line just to see if we get some additional information of why it fails to run from within codelite
Re: Format current sourcode: operable program or batch file
Posted: Wed May 31, 2017 5:06 am
by hptphuong
Please help me run it by command line. I don't know how do it
Re: Format current sourcode: operable program or batch file
Posted: Wed May 31, 2017 3:10 pm
by AJenbo
hptphuong:
Open a command prompt (cmd) and paste the following in it:
Code: Select all
C:\Windows\system32\cmd.exe /C "C:\Program Files\CodeLite\codelite-clang-format.exe" -assume-filename=main_app.cpp -style="{ BasedOnStyle: WebKit, IndentWidth: 4, UseTab: ForIndentation, 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 : true, IndentFunctionDeclarationAfterType : true, SpaceBeforeAssignmentOperators : true, SpaceBeforeParens : Never, SpacesInParentheses : false, BreakBeforeBraces : Linux, ColumnLimit : 120, PointerAlignment : Left }" -cursor=0 -offset=0 -length=508 "C:\Users\hptphuong\Documents\Self C++\learning\first\.code-formatter-tmp.cpp"
Hit enter and copy-pate the result to the forum so we can see it.
Re: Format current sourcode: operable program or batch file
Posted: Wed May 31, 2017 8:35 pm
by eranif
One thing to note here:
change the filename from: .code-formatter-tmp.cpp to the actual filename you want to format