13 VS Code Settings to Save You Time in AL
Slowly but surely, even the last dinosaur will venture out of the cosy safety of C/SIDE and C/AL to plunge death-defyingly onto the battlefield of the new programming language AL. Not everyone has the time to deal with all the VS Code Settings.
It’s enough if a dumb guy like me has nothing better to do and writes it down for the others. That’s why I’ve summarized some important settings here that can save you a lot of time. Easy to digest and with great screenshots (semi srs). Please note that these are my personal suggestions. I find them useful, you do not have to agree with me.
#1 Setting: Default Clone Directory
The default location to clone a git repository.
#2 Setting: Snippet Suggestions
Controls whether snippets are shown with other suggestions and how they are sorted.
Suggested value: Bottom
The default value “inline” sorts the suggestions like shown in the screenshot (first snippets, then the last suggestion “var”).
Changing the setting to “bottom” moves the last suggestion “var” to the top of the list.
I dedicated a whole post on the snippet suggestions. For more information, check it out here.
#3 Setting: Exclude
Configure glob patterns for excluding files and folders. For example, the file Explorer decides which files and folders to show or hide based on this setting. Refer to the Search: Exclude setting to define search specific excludes. Read more about glob patterns here.
Suggested value: Add folder “**/.alcache” to the excluded folders like on the screenshot.
Thanks to Waldo for finding this gem. This will make it a lot easier to search stuff in your files.
#4 Setting: Auto Save
Controls auto save of dirty editors. Read more about autosave here.
Suggested value: AfterDelay
The value is automatically set to “afterDelay” if you activate “Auto Save” in the menu “File”.
#5 Setting: Format On Save
Format a file on save. A formatter must be available, the file must not be saved after delay, and the editor must not be shutting down.
Suggested value: true
This will automatically indent your code and format it when you save your files. Pretty useful!
#6 Setting: Disable Default AL Snippets (CRS)
Disable the default AL Snippets. When you change the setting, you need to restart VSCode twice. Once for disabling the snippets on activation (at that time, the snippets are still loaded). And the second time to actually not load the snippets anymore.
Suggested value: true
Note: Make sure to set “Disable CRSSnippets” to false if you deactivate the default al snippets. Otherwise you may not have all important snippets anymore.
This will declutter your snippets a lot. This way it is easier to decide which snippets to take.
#7 Setting: Use Internal Navigation (AL Object Designer)
Use custom Go To Definition feature. (Auto-enabled on Linux)
Suggested value: false
If your editor keeps opening new files when you hover over variables in your AL Code, then you might want to disable this option. The screenshot should speak for itself.
#8 Setting: Fix Code Cop Missing Parantheses On Save (AZ AL Dev Tools)
Fix Code Cop “Missing Parantheses” warning on save when “editor.codeActionsOnSave” setting contains “source.fixAll” value.
Suggested value: true
#9 Setting: Ignore ALPrefix & Ignore ALSuffix (AL Variable Helper)
Remove prefix’s/suffix’s from variable names.
This is the result when you create a variable with the AL Variable Helper. The prefix “CCO” is removed.
#10 Setting: Enable Smart Commit
Commit all changes when there are no staged changes.
Suggested value: true
Note, danger, attention!!!: Read this blog post by Stefan Maron before enabling this. Stefan Maron suggests to disable Smart Commit, while I prefer to enable it. Either way, you should know what it does before you enable it. It will get you in trouble if you enable it without understanding it.
#11 Setting: Autofetch
When enabled, commits will automatically be fetched from the default remote of the current Git repository.
Suggested value: true
VS Code is able to periodically fetch changes from your remotes. This enables VS Code to show how many changes your local repository is ahead or behind the remote. Starting with VS Code 1.19, this feature is disabled by default and you can use the git.autofetch
setting to enable it.
Read more about it here.
#12 Setting: Background Code Analysis
Specifies whether the code analysis should be performed in the background.
Suggested value: small projects -> true, huge projects -> false
Read more about it here.
#13 Setting: Disable File Watcher On Change (AL Object Designer)
This option prevents filewatcher to update object cache on every file change. Useful for BaseApp customization.
Suggested value: small projects -> true, huge projects -> false
I hope it helps you.
If you can think of any other settings that definitely belong here, please let me know in the comments.
Mentions
46 thoughts on “13 VS Code Settings to Save You Time in AL”
Nice one 🙂 IMHO the suggestion for #10 will get you in trouble sooner or later
After disable “Use Internal Navigation”, option “Go to definition” stopped working, should I set another options ?
I do not know of any other option. Are you trying it in an “.al” file from your workspace or in a generated “.dal” file from a VS Code extension? I cannot really see it on the screenshot.