My last blog about my VSCode extension dates from July 2018. I have been upgrading/maintaining it meanwhile, and I am definitely not going to blog about all new small features and fixes (yes, quite necessary as well ;-)) every single time, but for this one, I really felt that an update wouldn’t hurt.
What is the “CRS AL Language Extension”?
The extension I’m talking about here is a free extension for VSCode that you can use to make your life for Microsoft Dynamics 365 Business Central App Development a little bit easier. The main parts of the extension are:
- Running objects in windows client and web client
- Automatically managing file names (and locations, if you want)
- Prefixing and/or suffixing (same link as above)
- A crapload of snippets for anything AL (also permissionsets, web services, design patterns, …)
If you want to know more, I can strongly advise you to have a look at the extension:
It has a staggering +37000 downloads and +12000 installs today, which is amazing :-). Thank you so much for using it – and for the many contributions on GitHub!
Let me now dive deeper into some points that are new to this release.
Rename/Reorganize files with git
“git” is the main word here. The extension can rename/reorganize files for quite some time now. If you want to know how it works, please read here.
There was a big disadvantage on this functionality: you would lose your file history, because for Git, this would be a delete file, and create a new one. The right way to rename a file, is actually using ‘git mv’, like Chris Blank pointed out on my GitHub. He was more than right, so I got to work, and after many attempts (and ways how not to do it), I seem to have finally succeeded. As this is a major thing, I didn’t want to just enable it by default (yet). Instead, I introduced a configuration setting “CRS.RenameWithGit” which you can set to “true” in your settings.json. At this point, the default setting is false, as I want people to deliberately set and test the feature first ;-).
FYI: it also works for the “Reorganize” function ;-).
Now, you can just decide in the middle of the project the completely revise your naming convention, and still keep your file history intact. How cool is that! :-).
The result is that you will have a part in “staged” and another part not. The staged part is the renamed-files, while the unstaged part is changes in the content of the file. Advised is to commit the staged first, and then commit the rest. As you can see in this screenshot:
The staged files are indicated with a green “R“, which indicates it was renamed. At some point, I might commit these files automatically (give me feedback on that if you want that).
I also added an output window, where I log the execution of the different actions the extension is executing for you. Just go to the output panel, and select the channel “crs-al-language”:
Very interesting because the links actually work, and you can see at the end of the day how useful the extension has been for you ;-).
New buttons to run an object
At the MVP Summit last week, I attended a session on “VSCode Extension Authoring”, where I got some ideas that I thought were interesting. A few were easy to implement, so I gave it a try, namely: running an object in the web client from:
- The status bar: when you have an al-file active, you will see a button in the status bar which you can click:
- And as you would guess, it opens that object in a web client.
- The file explorer (right mouse). The same functionality when you use the right mouse button in the file explorer:
I find myself using this all the time :-).
Something I didn’t do, but was completely implemented by somebody else, is the API for this extension, which basically means: other VSCode Extension can use the functionality of this extension by creating a dependency :-).
I even noticed that also the “AL Object Designer” is using my extension as a dependency 🙂
Cool stuff! If you don’t know these extensions, well, after you have crawled out of the bottomless pit of shame, download and install them, like I did :-)!
The Change Log
Every single update, I announce on twitter, but more importantly, I maintain the changelog in a quite detailed manner. You can find a link to this changelog on the Marketplace-site for the extension, as well as the extension-page in VSCode:
So don’t forget to check once-in-a-while, to see what changed :-).
If you have any questions or think I’m missing something, you can always either fork, do it yourself and create a pullrequest, like quite some people already did(for which many many thanks!), or simply provide feedback on the Github Issues that belong to this repo. Anything is always greatly appreciated!