VS Code extension

Caddyfile for VS Code

Catch what caddy adapt would tell you—a global option inside a site, tls inside a handle block, a matcher you never defined, an unknown subdirective, an unclosed brace—while editing, without the Caddy binary.

Open source and maintained by Juan Torchia.

Current release
v0.1.0
Marketplace downloads
0
Observed Dec 3, 2026
Compatibility
VS Code 1.110+ and Open VSX editors
License
MIT

See it in the editor

Caddyfile in VS Code flagging a global option inside a site, tls inside a handle block, an undefined matcher, an unknown subdirective, an unknown placeholder, and an exposed admin API in the Problems panel
Diagnostics mirror what caddy adapt would refuse, as you type.
Hover documentation for the reverse_proxy directive showing its syntax and description from caddyserver.com
Hover shows syntax and documentation from caddyserver.com.
Completion list offering http.request placeholders inside a header directive
Completion knows directives, subdirectives, matchers, and every placeholder.
Hover over the remote_host placeholder showing what it holds and the placeholder it stands for
Placeholders and their shorthands are documented on hover.
A Caddyfile after Format Document, indented with tabs like caddy fmt with its trailing comment kept
Formatting matches caddy fmt without joining, splitting, or removing lines.
Open in CertView CodeLens with the days until expiry above a tls directive that loads a certificate and key
Open in CertView appears above tls <cert> <key> when CertView is installed.

A focused tool for a specific workflow

Caddyfile validation, hover documentation from caddyserver.com, completion with placeholders, import navigation, a formatter consistent with caddy fmt, and TLS, security, and certificate checks inside VS Code.

  • A language server with a catalog of Caddy v2.11.9 generated from the caddyserver.com docs and the Caddy source: 45 directives with their subdirectives, 41 global options, 17 request matchers, and 139 placeholders
  • Diagnostics for global options in sites, directives in the global options block, site-only directives inside handle and route, undefined or duplicate matchers, snippets and named routes, and unbalanced braces
  • Zero diagnostics on 400+ Caddyfiles that caddy adapt accepts: Caddy's own adapter tests, every docs example, and real projects
  • Context-aware completion of directives, subdirectives, matchers, and placeholders, hover documentation from caddyserver.com, an outline of sites and snippets, and import navigation
  • A formatter that writes what caddy fmt writes, checked against caddy fmt itself, without ever joining, splitting, adding, or removing lines
  • TLS lint against the Mozilla Server Side TLS guidelines, a conservative security lint, certificate details for tls <cert> <key>, and an Open in CertView CodeLens

From install to a safer decision

  1. Install the extension and open a Caddyfile, Caddyfile.*, *.caddyfile, or *.caddy file, or a snippet file a Caddyfile imports.
  2. Review inline diagnostics and use context-aware completion, hover documentation, and Go to Definition for imports, snippets, named routes, and matchers while editing.
  3. Check TLS, security, and certificate findings, and open referenced certificates in CertView when it is installed.
  4. Run caddy adapt --validate (or the Check with caddy adapt command) before reloading the server.

How the pieces fit together

This is a textual architecture map grounded in the public implementation. Follow the source link to inspect the exact modules, tests, and release history.

  1. The VS Code client activates for Caddyfiles, switches files that a workspace Caddyfile imports to the Caddyfile language, and owns editor commands, settings, and the Open in CertView CodeLens.

  2. The client exchanges Language Server Protocol messages with a bundled language server whose tokenizer follows Caddy's lexer: quotes, backticks, heredocs, and line continuations.

  3. The server checks statements against a catalog generated from pinned Caddy docs and source, a Mozilla TLS catalog pinned to guideline 6.0, and reads referenced certificate and key files with Node's built-in crypto.

Inspect the implementation on GitHub

Supported scope

  • Caddyfile, Caddyfile.*, Caddyfile-*, *.caddyfile, *.Caddyfile, and *.caddy
  • Snippet and site files imported by a workspace Caddyfile, whatever their name
  • Global options, sites, snippets, named routes, single-site files without braces, and imported fragments
  • Certificates and keys referenced by tls <cert> <key> and ca_root

Explicit boundaries

  • Diagnostics are editor feedback, not a substitute for running caddy adapt or caddy validate against the target build and its plugins before reload or deployment.
  • The extension has no telemetry and no network access. The caddy binary runs only when you invoke one of its optional commands, certificate and key files outside the workspace are read only after opting in, and private key content is never shown or sent anywhere.
  • When filing public issues, use a minimal sanitized Caddyfile and remove hosts, addresses, credentials, certificates, and other production details.
Read the security policy

Get help, verify changes, or contribute

Issues and release history stay with the source repository so the evidence remains public.

Need this kind of workflow inside your team?

Start with a bounded workflow review. Product support stays in public issues; organization-specific discovery and implementation follow a private path.

Review the engagement