Categories:

Summary

This was a project born from some of my daily tasks within my Business Central development role. There are a number of processes that are repeated in each project and are manual tasks.

For example, one task is to create a Permission Set object per extension we create, which with larger extensions can be a cumbersome task. To resolve this I created a command that would look through all the .al objects within the workspace, sort them, create a new folder & file and use template literals to populate it with a common structure.

There are a range of commands related to the AL language, with some using the DevOps API workflow.

Technologies

Tools: Visual Studio Code, Postman (DevOps API testing)

Language(s): TypeScript

Key Libraries & Framework(s): Axios

What I Enjoyed

The testing and packaging process for VS Code extensions is simple and nicely integrated with available commands and debugging tools.

VS Code exposes a large API as standard which provides a lot of UI functionality (popups/confirmation boxes etc) which making use of helps maintain the standard VS Code experience.

Choosing TypeScript fit well with the project as VS Code is built on this and well typed. Being able to create types and interfaces for my expected data as well helps to streamline future changes easily.

I went with a more functional programming style, separating out the code into relevant functions so they could be re-used elsewhere easily.

What I Learned

I originally had all my code within a single AL development context, however this became a question when I started working on the DevOps APIs and Git features. Instead of continuing, I spent some time to rework this into seperate contexts relevant to the functions within them (AL, DevOps, Git). This way inside each context I needed only load the required services I needed. This also helps with sharing code between contexts as I can use a more “general” context to contain something that multiple sub-contexts may use.

General improvements to my TypeScript knowledge. This was the first time I’d integrated the DevOps API and Axios for HTTP requests so this came with a learning curve of understanding the methods available and handling unexpected responses.

Improvements

I could look into is adding sufficient test coverage to the commands added within the extension. As features are added; especially with the shared method of some of the functions, changes to one area could impact another.

Demo / Source

You can view the full source code on GitHub: https://github.com/DWarsop/dw-vscode

Tags:

Comments are closed