caddyserver / vscode-caddyfile

Rich Caddyfile support for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=matthewpi.caddyfile-support
MIT License
79 stars 3 forks source link

Syntax highlighting for Caddyfile adapter tests #299

Closed francislavoie closed 6 months ago

francislavoie commented 7 months ago

We have a bunch of tests in https://github.com/caddyserver/caddy/tree/master/caddytest/integration/caddyfile_adapt to ensure that a Caddyfile does indeed adapt to the expected JSON.

Right now we're just using .txt as the extension out of convenience, but I was thinking maybe we should come up with our own file extension for these like .caddyfiletest or something (bleh, it's verbose, but would certainly not conflict with other file types :joy:).

I think having support for highlighting that kind of file would be very nice to have so we can actually get warnings if the JSON is wrong (sometimes I have to hand-edit the JSON and I make a syntax mistake like missing a comma).

I think that should be pretty easy, right?

The spec is essentially:

I think it should be easy enough to make a lexer that passes down to the Caddyfile lexer for the first half and JSON for the second half, right?

/cc @matthewpi @mholt