Beautyfier error



  • Hi,

    I am running a Qt Creator 4.7.0 (MSVC 2015 32 bit) on a 64 bit Windows 10 Home (Version 1803). I tried to enable Artistic Style Beautifier. It appears in the menu but when I run it I get the following error message in General Messages:

    No winrtrunner.exe found.

    Error in Beautifier: Failed to format: The command “C:\AStyle\bin\AStyle.exe” terminated with exit code 1..

    How can I solve this problem? Is it related to the fact, that I am running a 32 bit version on a 64 bit OS?

    Thank you for your help.


  • Lifetime Qt Champion

    Hi
    Did you give it a config/format file to work with ?
    (in Tools -> Options )
    alt text



  • Hi,
    Yes.


  • Lifetime Qt Champion

    @gabor53
    maybe the format file have errors.
    try using Astyle from command prompt with your file and see



  • @mrjj
    It looks like this:
    0_1553028231367_53387934-68ce-46f0-8597-557171e78680-image.png


  • Lifetime Qt Champion

    and your .astylerc in the project folder is also there?
    Im asking as mostly seen this error when config cannot be found or parsed.



  • @mrjj
    I can't find .astylerc anywhere.


  • Lifetime Qt Champion

    @gabor53
    But your settings say it should look for one in the project folder.

    Please check
    "Use customized style"

    so it will use that one.
    (since you did not add a config file to the project folder, it sounds like)



  • @mrjj
    Here is what I have now:
    0_1553115438641_2019-03-20.png

    0_1553115619879_2019-03-20 (2).png

    The customized style includes the following:
    --indent-classes
    --style=java / --style=attach / -A2
    -s4 --indent=spaces=4
    --attach-namespaces / -xn
    --attach-classes / -xc
    --attach-inlines / -xl
    --attach-closing-while / -xV
    --indent-classes / -C
    --indent-switches / -S
    --indent-cases / -K
    --indent-namespaces / -N
    --indent-after-parens / -xU
    --indent-continuation=# / -xt#
    --indent-labels / -L
    --indent-preproc-block / -xW
    --indent-col1-comments / -Y
    --min-conditional-indent=# / -m#
    --break-blocks=all / -F
    --pad-oper / -p
    --pad-comma / -xg
    --pad-paren / -P
    --delete-empty-lines / -xe
    --align-pointer=type / -k1
    --align-pointer=middle / -k2
    --align-pointer=name / -k3
    --align-reference=none / -W0
    --align-reference=type / -W1
    --align-reference=middle / -W2
    --align-reference=name / -W3
    --break-closing-braces / -y
    --break-elseifs / -e
    --break-one-line-headers / -xb
    --add-braces / -j
    --add-one-line-braces / -J
    --break-return-type / -xB
    --break-return-type-decl / -xD
    --close-templates / -xy
    --remove-comment-prefix / -xp

    There is no error message just not doing anything.

    Thank you for your help.


  • Lifetime Qt Champion

    Hi
    make sure you run it on a CPP/H file. not QML.
    It wont format QML as far as i know.



  • Hi @mrjj ,
    When I try to run it on a cpp/h file I get the following error message:
    Error in Beautifier: Failed to format: The command "C:\AStyle\bin\AStyle.exe" terminated with exit code 1..

    Is there any beautifyer to format QML?
    Thank you.


  • Lifetime Qt Champion

    Hi
    Not sure what it means by that.
    Please try this config. and see.

    --style=kr 
    --indent=spaces=4 
    --align-pointer=name 
    --align-reference=name 
    --convert-tabs 
    --attach-namespaces
    --max-code-length=100 
    --max-instatement-indent=120 
    --pad-header
    --pad-oper
    

    I have not seen any external formatters for QML but I think the build in works pretty ok ?



  • @mrjj
    The built in QML formatter works great.
    I entered the codes you recommended into Options - Beautifier - Artistic Style - Options - Use customized style - edit, but got the same error message
    Error in Beautifier: Failed to format: The command "C:\AStyle\bin\AStyle.exe" terminated with exit code 1..


  • Lifetime Qt Champion

    Hi
    Ok, that is a bit odd.

    If you open a command prompt and type (past)
    C:\AStyle\bin\AStyle.exe
    it does run the tool and it lists its options ?



  • Hi @mrjj ,

    The command generated the error message below:

    C:\AStyle\bin\Atyle.exe : The term 'C:\AStyle\bin\Atyle.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
    path is correct and try again.
    At line:1 char:1

    • C:\AStyle\bin\Atyle.exe
    •   + CategoryInfo          : ObjectNotFound: (C:\AStyle\bin\Atyle.exe:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
      
      

    Thank you for your help.


  • Lifetime Qt Champion

    @gabor53
    hi
    you spelled it wrong
    C:\AStyle\bin\Atyle.exe << missing an s



  • @mrjj
    C:>C:\AStyle\bin\AStyle.exe

    Absolutely nothing happened.


  • Lifetime Qt Champion

    @gabor53
    Hi
    C:\AStyle\bin\AStyle.exe -h
    and see if its alive



  • Hi @mrjj,
    It is alive.


 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.