Format current sourcode: operable program or batch file

Post here any ideas/problems/suggestions you have regarding CodeLite's CodeFormatter (AStyle) plugin
hptphuong
CodeLite Curious
Posts: 8
Joined: Mon May 29, 2017 1:18 pm
Genuine User: Yes
IDE Question: PHP
Contact:

Re: Format current sourcode: operable program or batch file

Post by hptphuong »

Ok, It works with command line.

But how do i use it in codelite UI?

Could i need to pre-intall application or plugin more.

May be i miss some thing?
AJenbo
CodeLite Enthusiast
Posts: 41
Joined: Mon May 22, 2017 12:06 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Format current sourcode: operable program or batch file

Post by AJenbo »

That command is what codelite uses internally, we need you to copy the resulting text from the command prompt so that we can try and figure out why it isn't working from within codelite on your system.
hptphuong
CodeLite Curious
Posts: 8
Joined: Mon May 29, 2017 1:18 pm
Genuine User: Yes
IDE Question: PHP
Contact:

Re: Format current sourcode: operable program or batch file

Post by hptphuong »

Code: Select all

hptphuong@DESKTOP-EQ6QH1B C:\Users\hptphuong
> 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\main_app.cpp"
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

It gives the error.

But it's ok, if i run :

Code: Select all

hptphuong@DESKTOP-EQ6QH1B C:\Users\hptphuong
> "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\main_app.cpp"
{ "Cursor": 0, "IncompleteFormat": false }
#include "main_app.h"
#include "VanillaOption.h"
IMPLEMENT_APP_CONSOLE(MainApp)

MainApp::MainApp()
{
}

MainApp::~MainApp()
{
}

int MainApp::OnExit()
{
    return TRUE;
}

bool MainApp::OnInit()
{
    wxCmdLineParser parser(wxAppConsole::argc, wxAppConsole::argv);
    if(!DoParseCommandLine(parser)) {
        return false;
    }

    // place your initialization code here
    return true;
}

bool MainApp::DoParseCommandLine(wxCmdLineParser& parser)
{
    wxUnusedVar(parser);
    return true;
}
AJenbo
CodeLite Enthusiast
Posts: 41
Joined: Mon May 22, 2017 12:06 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Format current sourcode: operable program or batch file

Post by AJenbo »

Please try the following:

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\main_app.cpp""
Post Reply