[Gambas-bugtracker] Bug #1539: Option to turn off "code beautifying".

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Fri Mar 1 13:25:14 CET 2019


http://gambaswiki.org/bugtracker/edit?object=BUG.1539&from=L21haW4-

Cedron DAWG reported a new bug.

Summary
-------

Option to turn off "code beautifying".

Type             : Request
Priority         : Low
Gambas version   : Master
Product          : Development Environment


Description
-----------

As an alternative, having a "beautify my code" menu option, where the user can highlight a bunch of code and the beautifier could do its stuff on the selection would be nice to keep.  Allowing custom beautifying rules would be bonus.


The importance of horizontal spacing/alignment in comprehensibility.

Here is an excerpt from gambas.h:

		struct {
			bool (*Load)(const char *);
			bool (*CanLoadLibrary)(const char *);
			bool (*Exist)(const char *);
			bool (*IsLoaded)(const char *);
			char *(*Current)(void);
			bool (*GetInfo)(const char *, void **);
			void (*Signal)(int, void *);
			void (*Declare)(GB_DESC *);
		}
		Component;

Here is how I would have formatted it:

		struct 
		{
			bool            (*Load)( const char* );
			bool  (*CanLoadLibrary)( const char* );
			bool           (*Exist)( const char* );
			bool        (*IsLoaded)( const char* );
			char*        (*Current)( void );
			bool         (*GetInfo)( const char*, void** );
			void          (*Signal)( int, void* );
			void         (*Declare)( GB_DESC* );
		}
		Component;

I've never encountered this kind of function definitioning (I code in C as little as possible) before so it took me a little while to "get it".  Had you formatted it like the latter I would have "gotten it" right away.  The compiler doesn't care.


An example from my struct (amd general) parser (in progress):


As seen (and enforced) in Gambas IDE

Private Const NAME_CHARS As String = "$@_"
Private Const WHITE_SPACE_CHARS As String = " \t"
Private Const SEPARATOR_CHARS As String = ",."
Private Const MATH_CHARS As String = "+=*/^"
Private Const ENCLOSERS_OPENERS As String = "([{"
Private Const ENCLOSERS_CLOSERS As String = ")]}"
Private Const QUOTES_CHARS As String = "'\""

....

        Dim p As Integer
        Dim theLabelSpot As Integer
        Dim theCharacter As String
        Dim theLine As String
        Dim theCharType As Integer
        Dim theCharSubtype As Integer


I'd like to have it formatted like this:

Private Const NAME_CHARS        As String = "$@_"
Private Const WHITE_SPACE_CHARS As String = " \t"
Private Const SEPARATOR_CHARS   As String = ",."
Private Const MATH_CHARS        As String = "+=*/^"
Private Const ENCLOSERS_OPENERS As String = "([{<"
Private Const ENCLOSERS_CLOSERS As String = ")]}>"
Private Const QUOTES_CHARS      As String = "'\""

.....

        Dim p              As Integer
        Dim theLabelSpot   As Integer
        Dim theCharacter   As String
        Dim theLine        As String
        Dim theCharType    As Integer
        Dim theCharSubtype As Integer


System information
------------------

N/A




More information about the Bugtracker mailing list