Editing support for Asterisk extensions.conf dialplans.
Features
- Priority numbers in the gutter — resolves and displays the actual priority for every
exten/sameline, includingnandn(label)tokens. - Syntax highlighting — contexts,
exten/same/include/ignorepat/switchstatements, application calls, and comments, scoped toextensions.conf/extensions_*.conffiles. - Variable colouring —
${VAR}variables and inherited vars get their own colours, with_VAR(inherited one level) and__VAR(inherited by all descendants) each distinguished from a plain variable. - Goto/Gosub navigation — hover over a
Goto()/Gosub()call to see the resolved priority and line, click through to jump straight there. Matches Asterisk's extension pattern syntax (_X.,_9NXXXXXX, etc.), not just literal extensions. - Application/function hover docs — hover over any other application call (
Set,Dial,Answer, ...) or${FUNCTION()}call (${STRFTIME()},${LEN()}, ...) to see its syntax and a short synopsis, from a bundled curated dataset covering the most common ones. - Find All References — right-click a priority or label line to find every
Goto/Gosubcall that jumps to it, across the workspace. include => contextnavigation — Go to Definition on aninclude => contextstatement jumps to that context's[context]declaration; Find All References on a[context]declaration lists every context that includes it.- Diagnostics — flags duplicate priorities within an extension, unresolved
Goto/Gosubtargets, and unreachable code after an unconditionalGoto/Hangup. Variable-based targets (e.g.Goto(ctx,${VAR},1)) are recognized as call-time-only and not flagged. - Document symbols / outline view — contexts and extensions/labels show up in the editor outline and breadcrumbs for quick navigation.
- Snippets —
exten,same,context, andincludetab-triggers for quickly inserting new dialplan lines. - Code folding — collapse a context or an extension's whole priority chain from the gutter.
- Reference count CodeLens — a "N references" annotation above any priority/label line that's targeted by a
Goto/Gosubelsewhere; click through to see them all. - Dialplan flow diagram — "Asterisk Dialplan: Show Flow Diagram" renders a context-level Mermaid graph of the whole workspace:
include => contextfallback chaining and cross-contextGoto/Gosubcalls as edges, with unresolved targets shown as dashed red edges to a "ghost" node. Click any node to jump to that context's definition.
Troubleshooting
Syntax highlighting isn't showing up. This extension recognizes files named extensions.conf or extensions_*.conf automatically. If your dialplan lives under a different filename, add ;asterisk-dialplan as the very first line of the file — it'll be picked up and highlighted regardless of name.