Skip to main content

Notifications

How to Create AL Snippets Using Visual Studio Code For Microsoft Dynamics 365 Business Central

What Are AL Snippets ?

AL Snippets are pieces of AL code or small templates that can be recycled and reused for faster coding in Visual Studio code.

If you are working on AL then it show AL snippets and if you are working on other extension then it shows you that extension’s snippets.

Create Snippet in AL

We will Open Vs Code

Go to View then select Command Palette or  you can press COMMAND + SHIFT + P to open the command palette.

 

Find  “Preferences: Configure User Snippets”.

 

 

 Click “New Global snippets file”.

 

 

Give your snippets file name.

 

Snippet can be defined in Scope Prefix body and Description.

This will open up file with Filename.al.code-snippets extension in ~/Library/Application Support/Code/User/snippets/filename.code-snippets.

 

Here I have created a snippet for repeat until Loop in AL which we use frequently. We can use the snippet by typing Repeat and it will show us the Global Snippet in suggestion.

 

 

Use Snippet in AL

In the new line, writing repeat ,This will activate Intelligence and show you the series of snippets, including the one you just created. Choose repeat from the list, and it will add the until  line.

 

Here  see after we writing repeat it automatically entered until statement.

 

 

The AL snippet we have created will write the code for the Repeat until.

Snippet will reduce down our efforts of remembering the syntax.

Similarly, you can define as many user-defined snippets as you like for other functions.

 

The post How to Create AL Snippets Using Visual Studio Code For Microsoft Dynamics 365 Business Central first appeared on MADHDA Business Solutions.

The post How to Create AL Snippets Using Visual Studio Code For Microsoft Dynamics 365 Business Central appeared first on MADHDA Business Solutions.


This was originally posted here.

Comments

*This post is locked for comments