Caddyfile language server

Hi!

As I understand it, the whole point of Caddyfile is to make it easier to do configurations. I think Caddy can thank its Caddyfile format for a lot of its popularity since it is so approachable.

However, the one thing I miss is a proper language server.

I use language servers all the time, not only coding but also things like writing systemd units, Containerfiles etc. It reduces the amount of errors but even more so it makes it very easy to (re-)configure things that you may not work with on a daily basis. It really helps with discoverability for the average joe.

I found GitHub - caddyserver/vscode-caddyfile: Rich Caddyfile support for Visual Studio Code which i think contains a language server but it seems to only be packaged for vscode (personally I use neovim with mason, and there are other IDEs). I don’t know how official it is either.

I have considered moving to JSON and leveraging the JSON Schema (together with a JSON language server) but the JSON format is so much more verbose that it defeats the purpose of making things easier.

Can we please have a well-maintained Caddyfile language server (usable by all editors)?

2 Likes

It’s as official as it gets. It’s pretty well maintained.

The language server part could probably be ported to Go or Rust (and ship cross-platform binaries) to make it compatible with more IDEs. PRs are welcome if you want to help do that.

We’ll obviously not maintain tooling for IDEs we don’t ourselves use (as unpaid volunteers), so it’s up to the community to help fill the gaps.

I typically just use nano or VSCode for editing Caddyfiles myself (but I largely authored the format so I don’t feel much need for help, I’m confident I can write a correct Caddyfile the first try every time).

2 Likes

Yeah a language server would be cool. The community is welcome to work on ones they want!