The AL language comes with interesting CodeActions for AL, but they’re turned off by default, see what you get if you turn them on in this video:

In this video, Erik reveals several powerful but hidden code actions (quick fixes) built into the AL Language extension for Visual Studio Code that most developers don’t know exist — because they’re disabled by default. The discovery came from a conversation with Esben from Microsoft (the lead behind the AL compiler), who pointed Erik to a setting he’d never noticed.
The Hidden Setting: Enable Code Actions
The story begins in Visual Studio Code’s settings. When you navigate to the extensions settings for the AL Language extension, the options are sorted alphabetically. This means the first things you see are highly technical settings like “AL Profile Lens” and “Assembly Probing Paths” — not exactly inviting for casual exploration.
But if you scroll down to the letter “E,” you’ll find a critical setting: “Enable Code Actions”. This setting specifies whether code actions should be enabled for all source files in the current project. By default, Microsoft ships this turned off to preserve performance, since code actions require additional processing power.
Once you enable this setting, you unlock several incredibly useful quick fixes that appear as the familiar lightbulb icon in your editor.
Code Action #1: Fix Implicit With Statements
When you write code that uses implicit with references — accessing record fields without qualifying them with the record variable — the compiler gives you a warning: “Use of implicit with will be removed in the future. Qualify with Rec.”
With code actions enabled, you now get a quick fix option. You can either:
- Qualify a single occurrence — fix one field reference at a time
- Fix all occurrences in the object — qualify every unqualified field reference in the entire object at once
This is a massive time saver when working with legacy code that has many implicit references.
Code Action #2: Convert Explicit With Statements
For explicit with statements that you want to eliminate (since with is being deprecated), the code action can convert the entire with block to fully qualified statements automatically. For example, a block like:
with item do begin
Message(Description);
Message("Description 2");
end;
Gets converted so that each field reference is prefixed with item., and the with wrapper is removed entirely.
Code Action #3: Convert If/Else Chains to Case Statements
If you have a series of if/else if statements all checking the same field, the code action recognizes the pattern and offers to convert it to a case statement. The result is cleaner, more readable code:
case item."Inventory Posting Group" of
'100':
message('100');
'200':
message('200');
else
message('rest');
end;
Code Action #4: Implement Interface
This was the feature that originally prompted Erik’s conversation with Esben. When you create a codeunit that implements an interface, you typically get an error telling you that required members aren’t implemented. Previously, you’d have to manually write out each procedure stub or copy-paste from the interface definition.
With code actions enabled, you simply click the lightbulb and select “Implement Interface”, and all procedure stubs are generated automatically. Given interfaces like this one with dozens of procedures, it’s an enormous productivity boost:
interface testinterface
{
procedure ArchiveUnpostedOrder(var SalesHeader: Record "Sales Header");
procedure CheckSalesDocument(var SalesHeader: Record "Sales Header");
procedure CopyToTempLines(SalesHeader: Record "Sales Header"; var TempSalesLine: Record "Sales Line");
// ... many more procedures
}
One click of “Implement Interface” and the codeunit is populated with all the required procedure signatures and empty begin/end blocks:
codeunit 50100 "Implement" implements testinterface
{
procedure ArchiveUnpostedOrder(var SalesHeader: Record "Sales Header");
begin
end;
procedure CheckSalesDocument(var SalesHeader: Record "Sales Header");
begin
end;
// ... all remaining procedures auto-generated
}
Code Action #5: Convert to Rendering (Version 20+)
New in Business Central version 20, this code action converts the older report layout syntax (using DefaultLayout and separate layout properties) to the new rendering section structure. With one click, the DefaultLayout property becomes DefaultRenderingLayout, and a proper rendering section is generated:
report 50100 "Item Report"
{
DefaultRenderingLayout = "word.docx";
dataset
{
dataitem(Item; Item)
{
}
}
rendering
{
layout("word.docx")
{
Type = Word;
LayoutFile = 'word.docx';
}
layout("rdlc.rdlc")
{
Type = RDLC;
LayoutFile = 'rdlc.rdlc';
}
}
}
Why Aren’t These Better Known?
The core problem is discoverability. These powerful features are hidden behind a setting that is disabled by default for performance reasons. The VS Code settings UI sorts everything alphabetically, so there’s no way for the most impactful settings to surface to the top. As Erik points out, he produced over 200 videos on the channel without ever using these code actions — simply because he didn’t know they existed.
Summary
To unlock these hidden gems, go to VS Code Settings → Extensions → AL Language and enable “Enable Code Actions”. You’ll immediately gain access to five powerful quick fixes:
- Qualify implicit with — fix unqualified field references (single or all in object)
- Convert explicit with — replace
withblocks with fully qualified statements - Convert if/else to case — refactor chained conditionals into case statements
- Implement interface — auto-generate all procedure stubs for an interface
- Convert to rendering — migrate report layouts to the new rendering syntax (v20+)
By enabling and using these features, you not only save time but also provide feedback to Microsoft about what additional code actions would be valuable — turning the conversation from “you should build something that does X” to “could you add a code action for Y?”