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: add `caddyfile-test` #300

Closed matthewpi closed 6 months ago

matthewpi commented 7 months ago

This took longer than I expected to write, the solution was so simple but I just had to make it difficult for myself.

Utilizes a new .caddyfiletest (or .Caddyfiletest) file extension.

The grammar works by looking for ^-{10}$ (10 - characters in a row on a line by themselves, no preceding or trailing white-space will be accepted), after that an embedded JSON section is enabled until an un-indented closing bracket (}) is found.

Closes #299

/cc @francislavoie @mholt

francislavoie commented 7 months ago

Thank you!!

until an un-indented closing bracket (}) is found.

Is that actually needed? I think it would work fine without it, no? Cause there's no other language that follows after the JSON section.

Doesn't really matter I guess, just wanted to mention.

@mholt do you agree with .caddyfiletest extension? If so let's merge this then I'll do a PR to the caddy repo to rename all the files *.txt -> *.caddyfiletest

francislavoie commented 6 months ago

I poked @mholt about this again and got a :+1: so let's merge :)