AL extension release · 12.0AL Developmentofficial - Microsoftderived - from the source, no model text

AL Language extension 12.0

AL Language extension 12.0 for Business Central 2023 release wave 2 (BC23): previewed 2023-04-04, released 2023-10-02; 22 changelog entries, 19 GitHub issues linked.

Changelog on the Visual Studio Marketplace · Business Central 2023 release wave 2 · BC23

Introducing Namespaces: A New Way to Organize Your AL Code

We are excited to announce that AL for Business Central now supports namespaces. Namespaces are similar to other code languages, and they allow you to group your objects and code in a logical and hierarchical way. With namespaces, you can avoid naming conflicts between different extensions, and make your code easier to maintain and understand. You can also see the relationship between different objects at a glance, and use the dot notation to access them. For example, you can use MyNamespace.MyTable to refer to a table object in your namespace. Namespaces are optional, but we highly recommend using them to improve your coding experience and productivity. To learn more about how to use namespaces in AL, please check out our documentation here Namespaces in AL

Open Visual Studio Code from web client

This feature simplifies the process of setting up Visual Studio Code environments for investigation and troubleshooting by allowing one-click access from the web client, available in both from the Page Inspection and Help & Support pages. You can choose to create a new project or update an existing one, which is configured to match your running instance, including launch configurations and dependencies in the app.json file. Users can download required symbols, easily navigate to source definitions, and seamlessly attach to the current session for regular and snapshot debugging, eliminating manual setup efforts. For more information, see Troubleshoot in Visual Studio Code directly from the web client.

Introducing ALDoc: a new command line tool for generating reference documentation for AL extensions

ALDoc works with DocFx to create a static website that contains detailed information about the objects, methods, properties, and events in one or more .app files. You can use ALDoc to document your own extensions or explore the APIs of other extensions. To learn more about how to use ALDoc, visit Generating help with the ALDoc tool

Workspace support for Code Fixes

Addition of workspace support for Code Fixes, which allows to invoke Code Fix actions on a workspace.

New SecretText type

The new type SecretText is introduced to protect credentials and other sensitive textual values from being revealed through debugging. New method overloads are added to HttpClient and other related types to make use of the new type.

// The return value and parameter will not be debuggable
procedure Send(ContentTxt: SecretText; Credential: SecretText; TargetUri: SecretText)
    var
        Request: HttpRequestMessage;
        Response: HttpResponseMessage;
        Client: HttpClient;
        Headers: HttpHeaders;
        Content: HttpContent;
    begin
        Request.SetSecretRequestUri(TargetUri);
        Content.WriteFrom(ContentTxt);
        Request.GetHeaders(Headers);
        Headers.Add('Authorization', SecretText.SecretStrSubstNo('Bearer %1', Credential));
        Request.Content := Content;
        Client.Send(Request, Response);
    end;

Added report property ExcelLayoutMultipleDataSheets

Added a new Boolean report property ExcelLayoutMultipleDataSheets that controls how Excel data sheets are created when using an Excel layout. Use this property to emit root data items to separate Excel sheets or to a single sheet named Data. Multiple sheets will be named #DataItemName, where DataItemName is the dataitem name used in the report design. Adding new empty Excel layouts to the report will use the property value to determine the sheet structure.

The default is to use a single sheet for all data.

New FieldRef.IsEnum method

Addition of the new FieldRef.IsEnum method, which allows to check if a field is an enum.

Enhancing External Business Events with Versioning Capability

A version parameter has been introduced as an optional parameter to the external business event attribute. Version of an external business event serves to handle modifications to the event signature that could impact its consumers. If the version is not specified for an event, it is assumed to be version 0.0.

Ability to define fields in page customizations

We have added the ability to add groups and page fields using a table field as source expression in page customizations.

pagecustomization MyPageCust customizes MyPage
{
    layout
    {
        addfirst(Content)
        {
            field(MyPageCustField; Rec.MyTableField) { }
        }
    }
}

A new property AllowInCustomizations was introduced for table fields in order to specify whether they can be used as source expression for page fields created in page customizations. By default, table fields can be used as source expression for page fields created in page customizations.

Introducing SamplingInterval feature to Sampling type of Profiling

With the new parameter profileSamplingInterval in your launch.json snapshot configuration, you can specify the interval at which the sampling will be collected. The default value is 100ms.

Creating Rich Text Editor Controls

The ExtendedDataType has been extended to allow the new value, RichContent, which will tell the web client to render a Rich Text Editor. For now, the setting ExtendedDataType = RichContent is only allowed on page fields. The Rich Text Editor will only render if it is the only control in a root-level group in a page area (also known as a FastTab group); when creating the control you must also specify that MultiLine = true. and it’s backing data type must be either Text or BigText. You can refer to the sample code available for rich text editor for guidance on how best to utilize this control.

Add SetBaseLoadFields record API

Adds the ability to select all fields defined on the base table for initial loading on a record, only delay loading fields defined in table extensions.

Method Overloads - Smarter method signature recommendations

The language extension will now prioritize relevant overloads when the developer starts typing a method invocation. If the typed expression corresponds to a valid overload, it will always be the first recommendation and the correct active parameter will be highlighted. The rest of the recommendations will be sorted in the order of relevance based on the provided parameters.

AnalysisModeEnabled property

We have introduced the AnalysisModeEnabled property on list pages, which allows to enable or disable data analysis mode on the page. For more information, see Analyze list data using data analysis mode.

New supported types for Variant - List, Dictionary

It is now possible to assign List and Dictionary to a Variant. The Variant type has been augmented with two new properties IsList and IsDictionary to allow for detecting if it contains the relevant types.

Inlay Hints

Sometimes it is not obvious from the look of a method call, which parameters the arguments map to, so with the use of inlay hints, the name of the parameters can be written next to the arguments. That is one of the scenarios supported, have a look at these settings:

"al.inlayhints.functionReturnTypes.enabled": true,
"al.inlayhints.parameterNames.enabled": true

IntelliSense in the debug console

The debug console is used to evaluate variables in the AL debugger. With this release we have added AL-based IntelliSense support to the debug console. Unfortunately this is only true for the console window as the watch window does not yet have IntelliSense integration support. Also completion does not work based on keyboard input, but only on the mouse click.

Extend the default fieldgroups even when they are not defined on the base table

It is now possible to extend the ‘Brick’ and ‘Dropdown’ fieldgroups even when they are not defined on the base table. This is achieved by creating a table extension for the table and adding fields to the fieldgroups with the addlast keyword. If a fieldgroup already exists, the fields will be appended to the end of its field list. If it doesn’t exist, it will be created automatically with these fields only. If multiple extensions are defined on the same fieldgroup, the fields will be unique and their order will depend on the order of resolution of the applications.

Properties for exploring queries in the web client

We have enabled the properties UsageCategory, AboutTitle(ML), and AboutText(ML) for query objects as part of the support to explore queries from the web client.

GitHub Issues

  • #7306 AS0056 warning reported for supported country code with unexpected casing.
  • #6931 A TryFunction can explicitly return a value - but that value is discarded.
  • #7353 Special Char (&) in Object name makes DocComments.xml invalid
  • #7296 Fix icon alignment when using fileNesting
  • #7107 ControlAddIn/usercontrol in page loses its actual type when referenced in a pageextension, breaking passing to procs
  • #7381 Unalbe to go to definition on PermissionSet
  • #7389 AS0062 error on Reports with ApplicationArea assigned at the object level
  • #5173 Cannot convert Variant to List
  • #7437 Processing of message ‘al/createPackage’ failed with error: ’One or more errors occurred.
  • #7361 Folding of regions does no longer work
  • #7444 Analyzer exception when validating obsolete tags on field groups in table extensions
  • #7453 AL Developer Fails To Remember Cached Credentials - Every request needs a new devicelogin
  • #333 Make reference count also work on trigger that have AL methods related
  • #2742 Support for event subscribers in codeLens/references for field/table triggers
  • #5453 Find OnInsert/OnModify/OnValidate… usages in Visual Studio Code
  • #6918 RunPageView and SubPageView where suggests fields from wrong (parent) table
  • #7293 Confused compiler looks in wrong path for dependencies in multi-root workspaces
  • #7200 _ALException is in Section “Watch”
  • #7398 VS Code looses focus when Publishing

AppSourceCop

  • Added a new AppSourceCop.json setting ObsoleteTagMinAllowedMajorMinorOnSourceSymbols to enable AS0105 to also report diagnostics on references to obsolete pending source symbols. For backward compatibility, the default value is false and the rule is only reporting diagnostics on references to obsolete pending reference symbols.
  • Fixed validation of local and internal events with AS0073.
  • Fixed validation of ObsoleteReason for keys, views, field groups, page customizations, report extensions, permission sets, permission set extensions, and entitlements with AS0072, AS0073, AS0074, AS0075, and AS0076.
  • From runtime 7.2, AS0092 will enforce the usage of applicationInsightsConnectionString over applicationInsightsKey. This means that extensions using applicationInsightsKey will now get a warning and should use applicationInsightsConnectionString instead.
  • Added rule AS0118 for handling primary key fields length changes.
  • Added rules AS0035 and AS0040 to validate property breaking changes done on pages. More properties will be covered by these rules over time. Their default severity is set to Warning, but it will be changed to Error in the future.
  • Updated rules AS0082 and AS0083 validating breaking changes on enum extension values to allow fixing conflicts with enum values introduced in the base enum.

Miscellaneous

  • Fixed IntelliSense recommending non-extensible objects when writing an extension.
  • A new warning, AL0775 , is shown when using an explicit return value for Try methods, since the value is ignored.
  • AL0758 warning diagnostic has been introduced for when the names of two object members conflict. Whitespaces in names are internally replaced with an underscore during compilation, such that two different names can collide. For example, “my variable” and “my_variable” are conflicting names. From runtime 13.0, an error will be reported with AL0757.
  • Fixed an issue where the developer would need to reload the entire project when renaming a directory which contains AL files.
  • Shorten the text of code actions to lower the risk of them getting truncated.
  • Global launch configurations now appear in the configuration picker when creating a new AL:Go! project.
  • Fixed issue that the numeric property on table fields were not used.
  • Added a warning about invoking ModifyAll on fields with FieldClass = FlowField. This warning will become and error at a later date.
  • Dotnet control add-in access from page extensions is being deprecated as it is not supported by the runtime.
  • Fixed issue of an unexpected exception thrown when running AL Table Proxy Generator tool (altpgen).
  • CaseOf constructs with hundreds or even thousands of cases should no longer cause a crash.
  • Prevent the use of TestPage.Prev and TestPart.Prev in favor of TestPage.Previous and TestPart.Previous from runtime version 13.0.
  • Fix the order of which dataitems are executed when you have more than one dataitem added at the same anchor within Report Extensions.
  • Fix issue that Translating other apps OptionCaption, didn’t work if the field was based on an enum.
  • Fix the issue of invoking a code actions on a workspace where the code action was applied only to one project.
  • Added support for setting the Editable property of page fields to false from page customizations.
  • AA0219 diagnostic no longer reports that page actions must start with ‘Specifies’, since actions generally don’t specify something.
  • GoTo Implementation now provides results for procedures from dependent apps.
  • When viewing enums in source code from other apps, the implemented interfaces for the enums are shown as well.
  • Outline window and Sticky Scroll now works with added or moved controls, actions, etc.
  • Added configuration ‘al.algoSuggestedFolder’ to specify the suggested folder when using AL:Go!
  • Added configuration "al.compilationOptions": { "outFolder": "C:\\Temp" } to specify which folder the built project should be written to.
  • Adding new properties to the manifest to track source control and build system information.
  • Better error handling for malformed Word layouts.
  • Semantic highlighting is enabled by default. To control it add this to your settings: "[al]": { "editor.semanticHighlighting.enabled": true }
  • Added CodeLens support for controls/actions/views defined in page extensions and page customizations.
  • Added CodeLens support for triggers to find references in the related triggers (i.e. OnInsert <-> OnAfterInsert), in event subscribers that are using identifiers for the event and element names (i.e. OnInsert <-> OnAfterInsertEvent), and in system methods (i.e. OnInsert <-> Rec.Insert).
  • Added Find References (Shift+F12) support on trigger events in event subscriptions to find the related trigger definition, related triggers, other subscriptions to this event, and references from system methods.
  • Added Find References (Shift+F12) support on system methods to find the relevant system method calls, the related triggers, and the related tigger events in event subscriptions. This means that you can now search for references of a system method for a given object instance, for instance finding all inserts on the Customer table.
  • Improve hovering over Labels and Textconsts by showing their value.
  • Added ID property on CompanyProperty to retrieve the company ID.
  • IntelliSense for the SetCurrentKey method now suggests table keys instead of table fields.
  • Add option to specify tooltips for Notification/ErrorInfo actions.
  • From runtime version 13.0, the warnings AL0700 and AL0702 about specifying an explicit dependency on ‘Application’ and ‘System’ using the ‘dependencies’ properties in the app.json file will turn into errors. Instead, you should use the dedicated manifest properties ‘Application’ and ‘Platform’.
  • Added new virtual table “Extension Database Snapshot” for showing extensions that are synced in the database.
  • RunObject property supports running a query object.
  • Added warning AL0805 when using a quoted integer to refer to an object by its ID. An integer literal should be used instead. This syntax will be deprecated in version 14. A code fix was also added to automatically fix instances of this issue.
  • Fixed an issue where making a field protected on a table could cause a crash.
  • An issue has been fixed related to packaging that reproduces when within a workspace the outFolder and cachePackageFolder are the same.
  • Queries will show up in search in the web client.
  • When missing objects are referenced in the permissionset Permissions property, all will be highlighted and not just the first one.
  • Fixed an issue related to packing that reproduces when within a workspace the outFolder and cachePackageFolder are the same.
  • Fixed an issue where making a field protected on a table could cause a crash.
  • Fixed application of enum captions on report extension dataset columns.

Source: Visual Studio Marketplace, ms-dynamics-smb.al changelog, Microsoft’s text unchanged. Dates from the gallery’s upload records.