Editing Dynamics SL CST Files with VS Code

I often edit Dynamics SL (DSL below) customization files using a text editor. I find this especially helpful when working on customizations with levels between 100 and 299, or when the CST file contains several customizations. I export the customization(s), edit, then import back. I’ve started using VS Code for this recently. It’s easy to configure it.

First, add the “VSCode VBA” extension. Click View > Extensions and type VBA in the Search Extension box. Click “VSCode VBA”, then the green Install button. You might also like to install some related extensions, like “VSCode VBA Snippets”.

Second, create a file association for files with the extension CST, which the default extension for DSL customization files. Click File > Preferences > Setttings. Expand Text Editor and click Files, then under Associations click “Edit in settings.json”. Inside the outermost set of curly braces enter this line (if there’s not already a key for “files.associations”):
“files.associations”: { “*.cst”:”vba”}
If you already have the “file.associations” key, just add a comma after the last pair and add the pair inside its curly braces.

Now when you open DSL customization files, they should be color-coded and have (some) intellisense when you’re editing code. In addition, it will make scrolling past all the properties in an “All User” customization a snap, since it’s easy to see the wider custom code in the minimap.

While I expect there will be more to come with this, I like getting started.

Update (Sept. 16, 2020): VS Code now has an Associations section with an “Add Item” button. You don’t need to edit settings.json any more. Click “Add Item”, then enter “*.cst” under Item and “vba” under Value (without quotes). You can also use this with Transaction Import control files. For that enter “*.ctl” under Item and “vba” under Value.

Update (March 14, 2024): The path to the Associations in VS Code is File menu > Preferences > Settings > Text Editor > Files > Associations. I just installed an instance of VS Code on a new server and thought the post above wasn’t clear enough on where to find that setting.

Leave a Reply