Cannot get the Artistic Style Formatter to work in UE v24.10 and v24.20 (fixed)

Cannot get the Artistic Style Formatter to work in UE v24.10 and v24.20 (fixed)

4
NewbieNewbie
4

    Oct 02, 2017#1

    Hi,

    I am trying to use the Artistic Style Formatter in UE version 24 but for the life of me, I can't get it to work. No matter what I do, the currently open file (C++) will not change in any way when I press the “Reformat” button at the bottom of the dialog window.

    I suspect I am missing some setup step but looking through the help files and forums, I can't find anything helpful.

    I did find a cryptic note in one help file saying "Please note: The Artistic Style EXE is installed in the GNU subdirectory and must be selected prior to its first use.” Unfortunately, I am not sure what is meant by “must be selected prior to its first use”.

    Any help would be greatly appreciated.

    Thanks in advance, Paul

    6,602548
    Grand MasterGrand Master
    6,602548

      Oct 03, 2017#2

      I will report to IDM support by email that the note in help file for Coding Tab should be removed because of being not true anymore. Executable of Artistic Style Formatter must not be selected prior its first use.

      Please, make a print screen with Alt+PrtScr of the Artistic Style Formatter dialog window, save the image for example with Microsoft Paint as PNG file, and upload the PNG file as attachment to your next post. It is not really possible to help you without knowing the options configured for reformatting active file.

      It is also possible to to fill out this form:

      Indentation

      [ ] Case
      [ ] Class
      [ ] Inline comments
      [ ] Label
      [ ] Namespace
      [ ] Preprocessor
      [ ] Switch
      Max. instatement indent:
      Min. conditional indent:

      Style ...

      Mode ...

      Options file ... usually not used

      Formatting

      [ ] Add brackets
      [ ] Add one line brackets
      Align pointer ...
      Align reference ...
      [ ] Break after logical
      [ ] Break else if()
      [ ] Break blocks ...
      [ ] Close templates
      Empty lines ...
      [ ] Keep one line blocks
      [ ] Keep one line statements
      Max. code length:
      [ ] Tabs -> Spaces

      Space padding

      [ ] oper
      [ ] paren
      [ ] first-paren-out
      [ ] header
      [ ] paren-in
      [ ] paren-out

      And it would be good to know what is configured at Advanced - Settings or Configuration - Editor - Word wrap / tab settings for files with a file extension as the active file has for the items

      [ ] Use spaces in place of tabs
      Tab stop value:
      Indent spaces:

      Those settings are taken into account by UltraEdit on calling artistic style formatter for re-indenting the lines in active file.

      Let us also know which type of file you want to reformat with Artistic Style Formatter (*.cpp?) and what is the encoding of the file (ANSI, UTF-8, UTF-16).
      Best regards from an UC/UE/UES for Windows user from Austria

      4
      NewbieNewbie
      4

        Oct 03, 2017#3

        Thank you for the reply to my posting.  

        Concerning the information you requested, below are several screenshots which have the information you requested.

        before.png - shows a test C++ program open in UE just before I open the Astyle window.  This shows that the encoding on the file is ANSI - Latin I and the filename is test2a.cpp

        before.png (44.74KiB)

        options.png - shows the pop-up dialog box for the Artistic Style Formatter with the options I selected.

        options.png (20.24KiB)

        after.png - shows the C++ program just after I pressed the Reformat button.  Note the tabs were not converted spaces but the red bar (change line indicator) shows that all the lines were changed

        after.png (44.54KiB)

        Finally, I did check the tab setting and the Tab stop value is 2 and the Indent spaces is also 2.

        Please let me know if you would like any other information.

        Thanks again, Paul

          Oct 03, 2017#4

          I was playing around with formatter at bit more and happen to have the Output Window open when I ran it. When I ran it, I noticed the following info in that window:
          Invalid command line options:
          convert-tabstest2a.cpp

          For help on options type 'astyle -h'

          Artistic Style has terminated
          Looks like there is a problem with the way the command line is being formatted as the filename (test2a.cpp) is being concatenated with the options.

          After noticing this, I tried running it again letting everything default so that there were no options listed in the box to the left of the Refiormat button. When I run this way, the output window says:

          Formatted test2a.cpp

          and the program source code is successfully reformatted.

          As I would like to run with some of options specified, this is only a partial solution to my problem.

          Hopefully, this added info will be helpful in figuring out a fix to my problem.

          Thanks again, Paul

          6,602548
          Grand MasterGrand Master
          6,602548

            Oct 03, 2017#5

            Hi Paul,

            I detected the same as you on investigating the issue. I used Process Monitor of Sysinternals to see how exactly UltraEdit runs astyle.exe. Here is the issue report which I have just sent to IDM support by email.

            I report an issue with usage of Artistic Style Formatter on being executed with parameters which is not working anymore since UE v24.10.0.23.

            Do following to reproduce this issue with default configuration:
            • Open ArtisticStyleFormatter.cpp in UltraEdit.
            • Click on ribbon tab "Coding" on item to reformat active file with Astyle.
            • Select the style "stroustrup" and check option "Tabs -> Spaces", see attached image file ArtisticStyleFormatter.png.
            • Click on button "Reformat".
            The result is an active file with all lines indicated as modified although absolutely nothing changed in file.

            The reason is the command line used by UltraEdit to run Astyle.exe:

            Astyle --style=stroustrup --convert-tabs"%TEMP%\astEA96.tmp" -s2

            There is a space character missing between the list of parameters as defined in dialog and the name of the temporary file created by UE. For that reason Artistic Style Formatter does nothing because in interprets the parameter --convert-tabs with the file name appended as one invalid parameter and the result is a not reformatted temporary file read back by UltraEdit.

            The usage of Artistic Style Formatter with all options set to default in the dialog works as in this case just astyle.exe with file name and with option -s2 appended is executed by UltraEdit.

            This issue exists according to my tests from UE v24.10.0.23 to currently latest UE v24.20.0.35.

            The file ArtisticStyleReformatted.cpp contains the expected output with running Astyle with the options
            --style=stroustrup --convert-tabs -s2 created with UE v24.00.0.76 or any former version.

            ArtisticStyleFormatter.cpp contains exactly the code as I could see on your screenshots.

            ArtisticStyleFormatter.png contains nearly the same as your second screenshot. The only difference is that --style=stroustrup is also visible in the options field at bottom left edge.

            ArtisticStyleReformatted.cpp contains with only spaces for the indentations:

            Code: Select all

            // custom countdown using while
            #include <iostream>
            using namespace std;
            
            int main ()
            {
              int n = 20;
              while (n>0) {
            
                if (n==10) {
                  cout << "T-minus" << " ";
                }
            
                cout << n << ", ";
                --n;
              }
            
              cout << "liftoff!\n";
            }
            At the moment it is necessary to run GNU\astyle.exe in UE program files folder via a configured user tool with "%f" as place holder for active file being automatically saved before tool execution and the additional parameters --style=stroustrup --convert-tabs -s2 on the tool command line.

            Edit: As reply on my issue report I received an email to verify the fix of this issue with private user verification build 24.20.0.37. Paul, you have got most likely this private build too.
            Best regards from an UC/UE/UES for Windows user from Austria

            4
            NewbieNewbie
            4

              Oct 05, 2017#6

              Hi Mofi,

              Thank you for investigating this issue and identifying the problem. Hopefully, IDM will roll out a fix for this problem in the near future.

              In the mean time, I hope this posting is helpful to anyone else having similar problems with the Artistic Style Formatter in UE.

              Paul

              6,602548
              Grand MasterGrand Master
              6,602548

                Oct 14, 2017#7

                UltraEdit v24.20.0.39 was released public on 2017-10-11 with this issue fixed.
                Best regards from an UC/UE/UES for Windows user from Austria