AL EventLens
See event publishers and subscribers across your AL / Microsoft Dynamics 365 Business Central workspace, and the lines that connect them.
AL EventLens indexes [IntegrationEvent], [BusinessEvent], and [EventSubscriber] declarations in your AL workspace for Microsoft Dynamics 365 Business Central and its .alpackages dependencies, then surfaces the resolved publisher → subscriber graph in a searchable panel, an activity-bar view, and inline CodeLens hints. No more grepping across apps to figure out who is listening to which event.
Screenshots




Features
- Workspace-wide event index — Parses
.al files in the workspace and .app packages in .alpackages to build a single index of publishers and subscribers. Pre-BC22 ('Codeunit Name', 'OnEvent') and BC22+ (Codeunit::"Name", OnEvent) subscriber syntaxes are both recognized.
- Resolved subscriber → publisher links — Each subscriber is matched against its target publisher and marked resolved or unresolved. Unresolved subscribers usually mean the target app is missing from
.alpackages; resolved ones are click-jumpable.
- Trigger events as first-class publishers — Implicit table and page trigger events (
OnAfterDeleteEvent, OnBeforeValidateEvent, …) are synthesized as virtual publishers so subscribers to them resolve cleanly.
- Searchable webview panel — Publisher list with per-row subscriber count and hover tooltips; click a publisher to see all subscribers in a detail pane with resolved (
✓) / unresolved (⚠) badges, file path, and line number; click a subscriber to jump to its source. The two-pane divider is draggable (double-click to reset). A Publishers / Subscribers toggle at the top switches the panel between the publisher list and a flat, searchable list of every subscriber — resolved and unresolved alike.
- Panel filters — App and Kind dropdowns above the publisher list narrow the view to one source app or one AL object kind. The search box accepts
app:<id-or-name> and kind:<kind> prefixes as a power-user shortcut for the same filters (e.g. kind:codeunit OnAfterPost).
- Publishers view — A dedicated
AL EventLens activity-bar view drills four levels: source app (friendly Name + vendor from NavxManifest.xml, GUID fallback when missing) → AL object kind → object → event. Intermediate rows show (events / subscribers) counts so a busy subtree is obvious at a glance; every row has a codicon so the level reads without reading labels.
- Subscribers view — A second activity-bar tree, below Publishers, lists every subscriber the workspace declares — grouped owning app → object kind → object → subscribed event — with a
✓ / ⚠ resolved badge per row. Unlike the publisher-nested list, this surfaces unresolved subscribers (whose target app is missing from .alpackages), which otherwise appear nowhere. Click a row to open the panel focused on that subscriber.
- CodeLens — Live subscriber-count CodeLens above each
[IntegrationEvent] and [BusinessEvent] declaration. Click it to open the panel scoped to that publisher.
- Handler-function CodeLens — Above each test handler method (
[MessageHandler], [ConfirmHandler], [PageHandler], and the other nine handler attributes), a lens shows how many test methods name it in their [HandlerFunctions] attribute; click it for a references peek listing them. A handler no test references reads unused handler — dead test code the AL compiler never flags, since it only checks the opposite direction. Counting is scoped to the declaring test codeunit, matching how AL resolves handlers.
- Mermaid export — One command renders the current publisher's subscriber set as a Mermaid diagram for docs or design reviews.
- Incremental re-index on save — Saved AL files re-parse just the touched objects; the rest of the index stays warm.
- Indexing progress in the status bar — The initial workspace scan reports per-phase progress (scanning AL files, scanning
.alpackages, per-package reads, synthesizing triggers, resolving subscriber links) in the status bar, so large workspaces never look frozen during startup.
- Persistent cache — Parsed
.app results are cached in extension global storage, keyed by (appId, version, mtime), so re-opening a workspace is near-instant.
- VS Code Web ready — All file access goes through
vscode.workspace.fs, so the extension runs on vscode.dev and github.dev as well as desktop.
Commands
| Command |
Description |
AL EventLens: Open Panel |
Open the searchable publisher/subscriber webview panel. |
AL EventLens: Refresh Index |
Force a full re-index of the workspace and .alpackages dependencies. |
AL EventLens: Reveal Publisher |
Open the panel scoped to a single publisher (fired by the event CodeLens and by clicking an event row in the activity-bar tree). |
AL EventLens: Reveal Object |
Open the panel and filter the publisher list to a specific AL object (fired by clicking an object row in the activity-bar tree). |
AL EventLens: Reveal Subscriber |
Open the panel in Subscribers mode focused on a subscriber (fired by clicking a row in the Subscribers view). |
AL EventLens: Go to Subscriber |
Jump to the source location of a subscriber (fired by clicking a subscriber row in the panel). |
AL EventLens: Show Handler Usages |
Peek the test methods that reference a handler method (fired by the handler CodeLens). |
AL EventLens: Export to Mermaid |
Copy a Mermaid diagram of the current publisher's subscribers to the clipboard. |
Open Panel, Refresh Index, and Export to Mermaid are available through the Command Palette (search for "AL EventLens"). The rest take an argument and are fired by the surface that supplies it — CodeLens, the activity-bar views, and the panel — so they are hidden from the palette rather than listed there doing nothing.
Settings
| Setting |
Default |
Description |
alEventLens.cache.enabled |
true |
Cache parsed .app symbol results in extension global storage. |
alEventLens.indexOnSave |
true |
Re-index AL files incrementally when they are saved. |
alEventLens.scanAlpackages |
true |
Index .alpackages/*.app packages in addition to workspace source. |
alEventLens.includeAllAppVersions |
false |
When .alpackages carries multiple versions of the same app, index all of them instead of just the highest. |
alEventLens.includeTriggerEvents |
true |
Synthesize virtual publishers for table/page trigger events. |
alEventLens.codeLens.enabled |
true |
Show subscriber-count CodeLens above event declarations. |
alEventLens.handlerCodeLens.enabled |
true |
Show test-usage-count CodeLens above test handler methods. |
Requirements
- Visual Studio Code 1.85 or later.
Issues and feedback
Please file issues and feature requests on GitHub.
Contributing
See CONTRIBUTING.md for development setup, build/test commands, and pull-request expectations.
License
MIT
| |