I’ve recently again updated my “AZ AL Dev Tools” VS Code extension, but this time the list of all changes is a bit longer than usual, so I’ve decided to describe them here instead of using Twitter.
Bigger enhancements
Code Clean-up commands
I’ve added a new commands that can run other code transformation commands one after another to fix multiple problems in the code. There are 3 of them:
- “AZ AL Dev Tools: Run Code Cleanup on the Active Editor”
- “AZ AL Dev Tools: Run Code Cleanup on the Active Project”
- “AZ AL Dev Tools: Run Code Cleanup on Uncommitted Files in the Active Project”
The third command allows to run clean-up on uncommitted files only which can be faster if you are working on a big project and want to update your files only before committing and pushing them to the git server.
List of commands run by the clean-up can be defined in the “alOutline.codeCleanupActions” setting. It is an array of strings, these values can be selected:
- “RemoveWithStatements”
- “AddApplicationAreas”
- “AddToolTips”
- “RefreshToolTips”
- “AddTableFieldCaptions”
- “LockRemovedFieldCaptions”
- “AddPageFieldCaptions”
- “AddObjectCaptions”
- “FixKeywordsCase”
- “FixIdentifiersCase”
- “ConvertObjectIdsToNames”
- “AddMissingParentheses”
- “AddDataClassifications”
- “RemoveUnusedVariables”
- “SortPermissions”
- “SortPermissionSetList”
- “SortProcedures”
- “SortProperties”
- “SortReportColumns”
- “SortTableFields”
- “SortVariables”
- “RemoveBeginEnd”
- “FormatDocument” – formats document, can be used if format on save is disabled
- “TrimTrailingWhitespace” – removes spaces at the end of each line
Some of these commands ask for additional parameters before they can be run. If you run them separately, they will always do that but for code clean-up you can disable it and define parameters in the VS Code settings. If you do it in the project settings, you can be sure that every developer will run it the same way. These settings can be used:
- “alOutline.defaultAppArea”: default application area
- “alOutline.defaultDataClassification”: default DataClassification value
- “alOutline.defaultAddPageFieldCaptionsSettings” default settings for the AddPageFieldCaption command when run by the Code Cleanup, these properties can be set:
- “setActionsCaptions”: set action captions
- “setActionGroupsCaptions”: set action groups captions
- “setGroupsCaptions”: set groups captions
- “setPartsCaptions”: set parts captions
- “setFieldsCaptions”: set fields captions
- “setLabelsCaptions”: set labels captions
- “alOutline.defaultRemoveUnusedVariablesSettings”: default settings for the RemoveUnusedVariables command when run by the Code Cleanup, these properties can be set:
- “removeGlobalVariables”: remove global variables
- “removeLocalVariables”: remove local variables
- “removeLocalMethodParameters”: remove local methods parameters
- “alOutline.reuseToolTipsFromDependencies”: reuse tooltips only defined in these dependencies, if empty, all dependencies will be used. Each entry should be defined as “dependency publisher” + “space” + “-” + “space” + “dependency name”. You can also use “*” to use all dependencies and make sure that code clean-up won’t ask for these values.
Reusing tooltips from other pages
Another enhancement is the ability to reuse existing tooltips defined for the same table field on other pages in page wizards, “add multiple fields” page code action, “`Add ToolTips to the Active Editor/Project” and new “Refresh ToolTips from Dependencies in the Active Editor/Project” commands. The difference between “Add ToolTips…” and “Refresh ToolTips…” commands is that the second one updates all tooltips on the page fields while the first one adds them only if they are missing.
Reusing tooltips can be disabled by changing “alOutline.doNotReuseToolTipsFromOtherPages” setting to true.
You can also limit searching for existing tooltips to only a few dependencies of your project by listing them in the “alOutline.reuseToolTipsFromDependencies” setting.
There is also new “Reuse tooltip from other pages” code action available on the first line of page/page extension field and ToolTip property, it allows to select tooltip value from a list of tooltips defined for this table field on other pages in the current project and it’s dependencies.
New image browsers
There are 3 new image browsers that you can open using these commands:
- “AZ AL Dev Tools: Show CueGroup Action Images”
- “AZ AL Dev Tools: Show CueGroup Fields Images” – “Copy as action” and “Copy as promoted action” context menu items are not available in this case
- “AZ AL Dev Tools: Show Role Center Action Images”
Fix begin..end warning (AA0005)
I’ve added 2 new commands that can be used to remove begin..end statements around single commands. They don’t need warnings reported by CodeCop code analyzer, so you can keep code analyzers disabled:
- “Remove Begin..End around Single Statements from the Active Editor”
- “Remove Begin..End around Single Statements from the Active Project”
Lock removed fields captions
These new commands can be used to lock captions of “removed” table fields, so they no longer appear on the list of texts that have to be translated:
- “Lock Removed Table Field Captions in the Active Editor”
- “Lock Removed Table Field Captions in the Active Project”
Performance changes
Some time ago Frédéric Vercaemst reported that CodeActionsOnSave are very slow when you open large al project. It was very interesting investigation to find what is wrong. I’ve found that when you open a big project and enable code analyzers, they sometimes can use 100% processor power and won’t leave much for other processes, including my extension.
I’ve also found that with recent changes, when VS Code collects code actions, warning from code analyzers are no longer available on the list of diagnostics. It is good, because this function no longer is blocked by code analyzers still running in the background, so other extensions should return their code actions faster, but it also means that any code actions that needs these diagnostics no longer can return anything and you won’t see them under that yellow light bulb menu in code. It means that my functionality that was adding missing parentheses on document save or code fixes for AA0137 (unused variable) and AA0139 (possible text overflow) no longer works. I’ve decided to leave it like that by default as I already have separate commands for parentheses and unused variables that don’t need code analyzers diagnostics, but if you want, you can enable them back by changing “alOutline.enableCodeCopFixes” setting to true. Just remember that it will have negative impact on performance if you have large al project.
There is also another change that could improve performance. Because Microsoft code analyzers can be very busy with large al project and waiting for the response from Microsoft AL language server can take some time, saving documents can sometimes be slow as VS Code will wait for this language server to format your document. That’s why I’ve added a new “FormatDocument” option to the “alOutline.codeActionsOnSave” setting in my extension. If default saving document is slow, you can try to disable default VS Code auto format on save and use this new option. It calls the same formatting functionality from AL compiler that the standards Microsoft AL Extension, but because my extension runs separate process that is not busy with code analyzers, there is a chance that it will finish earlier.
Small fixes and enhancements
There are also other small bug fixes and enhancements, here is the list:
- Issue #301 – PermissionSet wizard – PermissionSet name length cannot be longer than 20 characters
- Issue #306 – Add MaxLength property to Caption when Permission Set is created
- Issue #215 – Empty lines at end of new files – new setting “alOutline.noEmptyLinesAtTheEndOfWizardGeneratedFiles”
- Issue #310 – SortProperties fails in case of extra semicolon
- Issue #295 – Typo fix
- Issue #275 – Symbols Browser – Go to definition (project file or server definition) – shared file access fix
- Issue #307 – Allow the Syntax Visualizer sash to be moved further
- Issue #308 – If possible, only show context menu items when relevant
Thank you
I won’t be able to do all these changes without people reporting them on my github. I would like to say “Thank You for all your ideas and bug reports” to all these people:
- mjmatthiesen
- fvet
- GreatScott000
- fvet
- dannoe
- rvanbekkum
- jhoek
- and others that reported issues earlier and are still waiting to be fixed or have been fixed in the previous releases



