Al: AutoFormat curley brackets

Created on 22 Jan 2018  路  9Comments  路  Source: microsoft/AL

I would want to change the behavior of the AutoFormat feature (ALT+SHIFT+F): it now puts my "{" bracket automatically to the next line .. which I hate ;-).

Personally, I would avoid inserting carriage return alltogether, and focus only on formatting the line itself.. .

al-format enhancement

Most helpful comment

+1 from me

Reports are another objects that would have much more readability with the emplty curly brackets in the same line as the column declaration:
column(CompanyAddress1; CompanyAddr[1]) { }
column(CompanyAddress2; CompanyAddr[2]) { }
column(CompanyAddress3; CompanyAddr[3]) { }
column(CompanyAddress4; CompanyAddr[4]) { }
column(CompanyAddress5; CompanyAddr[5]) { }
column(CompanyAddress6; CompanyAddr[6]) { }
column(CompanyHomePage; CompanyInfo."Home Page") { }
column(CompanyEMail; CompanyInfo."E-Mail") { }
column(CompanyPicture; CompanyInfo.Picture) { }
column(CompanyPhoneNo; CompanyInfo."Phone No.") { }
column(CompanyPhoneNo_Lbl; CompanyInfoPhoneNoLbl) { }
vs:
column(CompanyAddress1;CompanyAddr[1])
{
}
column(CompanyAddress2;CompanyAddr[2])
{
}
column(CompanyAddress3;CompanyAddr[3])
{
}
column(CompanyAddress4;CompanyAddr[4])
{
}
column(CompanyAddress5;CompanyAddr[5])
{
}
column(CompanyAddress6;CompanyAddr[6])
{
}
column(CompanyHomePage;CompanyInfo."Home Page")
{
}
column(CompanyEMail;CompanyInfo."E-Mail")
{
}
column(CompanyPicture;CompanyInfo.Picture)
{
}
column(CompanyPhoneNo;CompanyInfo."Phone No.")
{
}
column(CompanyPhoneNo_Lbl;CompanyInfoPhoneNoLbl)
{
}

All 9 comments

We don't provide a way for you to control the formatting rules but you can select a piece of the code and use "Format Selection [Ctrl+k, Ctrl+F]" instead to only format parts of the code.

Then consider is as a feature request.
I know this particular request is being discussed internally. And here you have my personal opinion ;-).

The "format selection" doesn't help much .. we should always be able to format all ... .

Well, this looks like something people will adamantly argue about...
I think Microsoft should release an AL guidelines document here, defining what is the preferred way of naming variables and functions, formatting code, etc.

We are working on releasing a style guide for these kind of situations.

The style guide and formatter will be aligned. When it comes to code style there will always be different opinions, and people will argue fiercely for their point of view. As a result we will ultimately end up with a style guide that not everyone is happy about.

We believe in only having one style/formatting, so that all (formatted) code have the same layout, is providing more overall goodness for everyone in the AL community than having a full customizable formatter.

Is anything new about the AL guidelines?

Adding to waldo's request: when having a empty curly bracket set (like you can have on page when having added fields without any properties set or code added), please put this set on the same line as the field "heading", f.e.
field("Example Enabled"; "Example Enabled") { }
and not
field("Example Enabled"; "Example Enabled")
{
}
This gives better overview on the object.

+1 from me

Reports are another objects that would have much more readability with the emplty curly brackets in the same line as the column declaration:
column(CompanyAddress1; CompanyAddr[1]) { }
column(CompanyAddress2; CompanyAddr[2]) { }
column(CompanyAddress3; CompanyAddr[3]) { }
column(CompanyAddress4; CompanyAddr[4]) { }
column(CompanyAddress5; CompanyAddr[5]) { }
column(CompanyAddress6; CompanyAddr[6]) { }
column(CompanyHomePage; CompanyInfo."Home Page") { }
column(CompanyEMail; CompanyInfo."E-Mail") { }
column(CompanyPicture; CompanyInfo.Picture) { }
column(CompanyPhoneNo; CompanyInfo."Phone No.") { }
column(CompanyPhoneNo_Lbl; CompanyInfoPhoneNoLbl) { }
vs:
column(CompanyAddress1;CompanyAddr[1])
{
}
column(CompanyAddress2;CompanyAddr[2])
{
}
column(CompanyAddress3;CompanyAddr[3])
{
}
column(CompanyAddress4;CompanyAddr[4])
{
}
column(CompanyAddress5;CompanyAddr[5])
{
}
column(CompanyAddress6;CompanyAddr[6])
{
}
column(CompanyHomePage;CompanyInfo."Home Page")
{
}
column(CompanyEMail;CompanyInfo."E-Mail")
{
}
column(CompanyPicture;CompanyInfo.Picture)
{
}
column(CompanyPhoneNo;CompanyInfo."Phone No.")
{
}
column(CompanyPhoneNo_Lbl;CompanyInfoPhoneNoLbl)
{
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bvbeek picture bvbeek  路  3Comments

AndersMad picture AndersMad  路  3Comments

kine picture kine  路  3Comments

worldofthenavcraft picture worldofthenavcraft  路  3Comments

ghost picture ghost  路  3Comments