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:
The file always starts with Caddyfile text
In between, 10 dashes ---------- acts as a delimiter
The file then ends with JSON text
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?
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:
----------
acts as a delimiterI 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