Hi, Readers.
The public preview for Dynamics 365 Business Central 2024 release wave 1 (BC24) is available. Learn more: Link.
I will continue to test and share some new features that I hope will be helpful.
In this post, I would like to talk about Folding usings (Collapses all of the using statements). This is not yet documented in the Business Central 2024 release wave 1 (BC24) release plan. But it is mentioned in AL Language extension changelog Version 13.0
It’s now possible to use the “editor.foldingImportsByDefault” setting. When set to
https://marketplace.visualstudio.com/items/ms-dynamics-smb.al/changelogtrue
it collapses all of theusing
statements when a file is opened.
In Business Central 2023 release wave 2 (BC23), Microsoft released the AL Namespaces. Namespaces are used to organize code into logical groups and hierarchies, which can prevent naming conflicts that can occur when libraries are combined. Namespaces ensure uniqueness in code names and allow reuse of names in different contexts, and provide structure for the code base, making it easier to navigate and understand.
More details: Business Central 2023 wave 2 (BC23): Segment AL code and reduce naming conflicts with namespaces (Namespaces in AL)
To refer to objects in other namespaces, you can either use the fully qualified name, or the using
directive. The using
directive is used to refer to objects in other namespaces without having to use the fully qualified name. The using
directive is placed at the top of the .al file, after the namespace declaration and before any object declarations. The following example shows the order of the namespace
declaration and the using
directive. The order of the using
directives doesn’t matter. More details: The using
directive
But there is a small problem. When there are a lot of using directives, we need to scroll down a long way to get to our own code.
With this wave (BC24), Microsoft has made the “editor.foldingImportsByDefault” setting also applicable to AL Language. More details about Automatically fold imports.
Let’s see more details.
In Settings:
Folding Imports By Default: Controls whether the editor automatically collapses import ranges.
In settings.json:
“editor.foldingImportsByDefault”: Controls whether the editor automatically collapses import ranges.
“editor.foldingImportsByDefault”: false
“editor.foldingImportsByDefault”: true
Test video:
It should be noted that according to my testing, so far it is only effective for local files. Standard objects opened using AL Explorer or AZ AL Dev Tools still display using statements by default.
Great improvement, give it a try!!!😁
END
Hope this will help.
Thanks for reading.
ZHU
コメント