CRS AL Language Extension – version 1.1.0

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).

Output Window

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 :-).

API

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’m very grateful to Andrzej Zwierzchowski, who implemented it in my extension by this pullrequest, to be able to use it in his “AL Code Outline“-extension.

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 :-).

Provide feedback

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!

5.00 avg. rating (98% score) - 2 votes

Permanent link to this article: https://www.waldo.be/2019/03/27/crs-al-language-extension-version-1-1-0/

4 comments

Skip to comment form

  1. Good morning Waldo.
    First of all, thank you ever so much for your work.
    And second, since this update, when I try to reorganice all files it gives me this error:
    “Cannot read property ‘uri’ of undefined”

    Thnx…..

      • waldo on March 28, 2019 at 10:18 am
        Author

      Yep, it has been brought to my attention .. working on it, but no clue, because I have no valid repro-scenario.
      You can track progress here:
      https://github.com/CloudReadySoftware/crs-al-language-extension/issues/110

  2. My favorite extension for VSCode, BC/AL development would not be the same without it.
    Personally I never had any issues with the “old Rename” and Git. It was a bit annoying that it showed the files as deleted/added while in VSCode. But once committed then Git always marked them correctly as renamed. If you didn’t commit right after the rename and made other major changes to the file, then sometimes it failed.

      • waldo on March 28, 2019 at 4:58 pm
        Author

      Thanks, Erik – very nice to hear :-).

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.