Get the Modern Development Experience in Sublime Text

(Disclaimer, everything in this post is a hack, at this point, it’s all about making it work, then we can use nice folder names etc. later, read the name of my website ๐Ÿ™‚ )

So Visual Studio Code is great, and an awesome tool, but for some deep primal reasons, the choice of text editors has always been very personal for developers. My personal choice is SublimeText.

So why not try to get the new developer tool to run with Sublime?

First, let’s look at what we get in VS Code right now with the “AL Extension”:

  • Source highlighting
  • Intellisense
  • Compiler
  • Deploy

Let’s start with source highlighting

Source highlighting is the process that renders your code in specific colors based on text types and word. It looks like this in VS Code

dev-in-sublime1

VS Code uses TextMate format to describe the text. TextMate has become the defacto standard for syntax highlighting andย  (big surprise) Sublime Text also uses TextMate.

So the following copy command: (executed from the \users\you folder, and replace xxxx with the version number of your AL dev extension).

xcopy .vscode\extensions\Microsoft.al-0.xxxx\syntaxes\*.* AppData\Roaming\Sublime Text 3\Packages\User\AL\*.*

That will copy the AL Code syntax into Sublime Text’s setup. After that, when you open an .AL file, you’ll get this:

dev-in-sublime2

Notice that even though the colors are not the same, the coloring scheme is the same. Keywords are colored, numbers are colored, the text string in the message command is colored.

That was easy ๐Ÿ™‚

Let’s compile from Sublime Text

Next on the list is the compiler, let’s see if we can get Sublime Text to compile for us. But wait, first, let’s locate the compiler.

The compiler is called ALC.EXE and is located in the bin folder of the VS Code AL Extension (Under C:\Users\you\.vscode\extensions\)

You can supply the following parameters to ALC:

-project:<root path of source tree> (This is where app.json is located)
-out:<name of navx file>

So to build an extension, you call

ALC -project:<folder> -out:module.navx

And if everything compiles, you got a NAVX file, ready for deploy.

In Sublime Text go to Tools->Build System->New Build System…

dev-in-sublime3

And let’s just create one simple command: (again replace xxx with the correct version):

{
ย ย  ย "shell_cmd": "C:\\Users\\vmadmin\\.vscode\\extensions\\Microsoft.al-0.xxxx\\bin\\alc.exe -project:$file_path -out:extension.navx"
}

Save the file as “AL” something, navigate to one of your AL files, and press F7 (Build in Sublime Text)

dev-in-sublime4

Success, the AL Compiler is called from Sublime Text and an extension is created (screenshot is from a test where I checked how errors were presented).

Next chapter, deployment ๐Ÿ™‚

Share thisShare on FacebookTweet about this on TwitterShare on RedditShare on Google+Share on LinkedIn

4 thoughts on “Get the Modern Development Experience in Sublime Text”

  1. is there a way to do this with the txt object exports? trying to figure it out. let me know if you do find it. if I find it I’ll reply to this as how to set up vs code to view txt object exports in color instead of drab grey.

      1. well that was a fast response. I let the developer preview lapse in the azure subscription. so I can’t find the extra extensions that were in those directories you’re referring to and have been looking for over an hour now for them. you wouldn’t happen to know where they may be. just curious if there’s some a way to have the syntax highlighting when using visual studio code. I’m not intending compile anything. just looking through object text files for an upgrade. when looking at the code it’s hard to find the sections in the text files where the conflicts are. so I’d just like some color so it’s easier on the eyes

Leave a Reply