How to create documentation comment using Custom Snippets in VS Code for AL - D365 Business Central.

Code documentation is a process of writing additional information to help others understand how your code works. It can include anything from comments in the code to separate documents that explain the code’s architecture, dependencies, and purpose. Also, development teams have their own format for the documentation.



Writing the document comment every time can be time consuming. For this we can create custom Snippets.
To create a custom code documentation comment using snippets in Visual Studio Code, you can follow these steps:
In VS Code Go to Settings -> User Snippets



Select AL as we want this Snippet for AL language.



al.json file will open then add configurations as follows:
  • Add a new object with a name for your snippet and a prefix that will trigger the snippet. For this example, we write tDocumentationComment
  • Add a description field to describe what the snippet does.
  • Add a body field with the code you want to include in the snippet. You can use placeholders like ${1:variable} to allow the user to tab through the snippet and fill in their own values.


Now in the code whenever we writhe tDocumentationComment in out AL file (Ctrl+Space to open Snippet menu) the documentation snippet will show.



By selecting the snippet our custom Documentation Comment will be auto generated. It will also support Tab to input different attributes we have set before.



Similar way we can create any custom snippet for any frequently used codes blocks in our projects.

Comments

Popular posts from this blog

Different use of AL Find Functions for Filters in Dynamics 365 Business Central

Microsoft Dynamics NAV - Creating and Consuming a Codeunit Web Service