Does format in IDE allow user customization?

I see that there is now a Format Document and Selection menu item. Is it possible to do user customization of the format? Iā€™d love to be able to automatically reformat my file, but I donā€™t like how the current formatter does it.

Not currently, what differences are you looking for?

LOTS :smile:

I like to use hanging indents for what I think is better readability. From back in my PL/I days of Structured Programming Facility in the 1970s where all this sort of stuff was already done and we are figuring it all out again. :smile:

For instance, I prefer something like:

namespace Guardian.EditObservation.Views;

interface

   uses
      System,
      System.Collections.Generic, 
      System.Windows,
      System.Windows.Data,
      System.ComponentModel,
      System.Threading,
      System.Windows.Input,
      System.Windows.Controls,
      System.Windows.Threading;

   // ------------------------------------------------------------------------------------------------------------------------------------------------------
   // unfortunately, this does okay, but when something like "my test" is wanted to be located, as soon as the space bar is pressed, the listbox drops down.
   // leaving it that way for now.  In future, if we can ever get to SL 5, the combobox has this feature of list search built in.
   // ------------------------------------------------------------------------------------------------------------------------------------------------------
   type
      GeneralInfoView = public partial class(System.Windows.Controls.UserControl)
         private
            method ShowCategory1Combobox_Click( sender: System.Object; e: System.Windows.RoutedEventArgs );
            method ShowCategory2Combobox_Click( sender: System.Object; e: System.Windows.RoutedEventArgs );
            method ShowCategory3Combobox_Click( sender: System.Object; e: System.Windows.RoutedEventArgs );
            method ShowCategory4Combobox_Click( sender: System.Object; e: System.Windows.RoutedEventArgs );
            method ShowCategory5Combobox_Click( sender: System.Object; e: System.Windows.RoutedEventArgs );
            method ShowCategory6Combobox_Click( sender: System.Object; e: System.Windows.RoutedEventArgs );
            method ShowObserverCombobox_Click(  sender: System.Object; e: System.Windows.RoutedEventArgs );
         private
            method worker_RunWorkerCompleted( sender: Object; e: RunWorkerCompletedEventArgs );
            method PopulateChoices(           sender: Object; e: DoWorkEventArgs             );
         private
            currentCombo      : ComboBox;
            currentKeystrokes : string;
            backPressed       : boolean;
            locatingSelection : boolean;
            method LocateSelection;
            method Combo_SelectionChanged(sender: System.Object; e: System.Windows.Controls.SelectionChangedEventArgs);
         
         private
            method DropDownToggle_Click(sender: System.Object; e: System.Windows.RoutedEventArgs);
            method AutoCompleteBox_Populating(sender: System.Object; e: System.Windows.Controls.PopulatingEventArgs);
         private
            method Title_TextChanged(sender: System.Object; e: System.Windows.Controls.TextChangedEventArgs);
         private
            method GetFocusControl: Control;
         private
            method GeneralInfoView_KeyUp(   sender: Object; e: KeyEventArgs );
            method GeneralInfoView_Loaded(  sender: Object; e: RoutedEventArgs    );
         public
            constructor;
            property FocusControl : Control read GetFocusControl; 
         end;



implementation

   uses
      System.Collections,
      System.ComponentModel.DataAnnotations,
      System.Globalization,
      System.Windows.Media,
      System.Linq,
      Guardian.Categories,
      Guardian.Controls,
      Guardian.EditObservation.DataContracts, 
      Guardian.EditObservation.Dialogs, 
      Guardian.EditObservation.ViewModels,
      Guardian.EditObservation.ViewModels.Classes, 
      Guardian.ValidationErrors;
      
   constructor GeneralInfoView; 
      begin
      try
         Guardian.Classes.GlobalResources.AddLocalization;

         Guardian.Classes.GlobalResources.ResourceList.Add( '/GlobalResources;component/Assets/ViewResources.xaml'         );
      
         Guardian.Classes.GlobalResources.LoadResources;
      except
         on e:Exception do begin
            raise new Exception( 'Failure during Resource loading' + Environment.NewLine + 'message:' + e.Message + Environment.NewLine + 'stacktrace:' + e:StackTrace + Environment.NewLine + 'innerexception:' + e:InnerException );
            end;
         end;

      InitializeComponent;
      
      Loaded += GeneralInfoView_Loaded;  // mlt probably needs an unloaded to unhook the Loaded event
      end;

I like the begin and end to line up, generally, but the important part is the indent, not the syntax. The compiler will figure out the syntax. So, all lines of a block are indented the same. I once read a name for this style in some other system where you could choose the style you wanted for the format, but unfortunately, I donā€™t remember what they called it.

I also like vertical white space between most blocks. One of the annoying things that happens, though I have tried it yet in this new to me environment, is that when I create a new procedure and put in the ā€œbeginā€, the editor puts in a blank line followed by the ā€œendā€. And that is good as far as it goes, but that ā€œendā€ is usually put just above the procedure that followed it instead of maintaining the blank line before the next procedure.

Also like the ā€œusesā€ statement indented under the ā€œInterfaceā€ or ā€œImplementationā€ statements. And then I like all the uses namespaces to be indented under the ā€œusesā€. Every time I write some code that automatically puts the namespace in (which I like a LOT), it does maintain the indent level of all the others in the ā€œusesā€ statement so I have to go neaten that up every now and then.

etc.

FWIW, the old SPF had a way where you easily exclude from view all the lines in a block. A block could be a beginā€¦end or a program or a method. But once it was excluded, it was represented by a single line of dashes. Then the cool part was you could do a ā€œshow 10ā€, for instance, and it would show the first 10 lines at outer most indent level and keep all the details of the ā€œsub indentedā€ lines still as dashed lines. This made it very easy to see the overview at the level you were interested without pulling out syntactical candy and statements that were at a further level of indentation.

Youā€™d probably have to see it in action to appreciate it, but it is something I have missed for a LONG, LONG time in the various editors Iā€™ve used since.