caddyserver / vscode-caddyfile

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

header Content-Type text/* ruins highlighting #231

Closed tomquas closed 2 years ago

tomquas commented 2 years ago

System Information

Describe the bug i defined the section below to import from host specs:

(encode) {
  encode {
    gzip
    zstd
    match {
      header Content-Type application/json*
      header Content-Type application/protobuf*
      header Content-Type application/javascript*
      header Content-Type text/*
    }
  }
}

the last header statement's text/* ruins highlighting such that all following statements are shown without coloring. By moving that line up and down you can track the effect to this part of the header statement.

Expected Behavior Keep highlighting going.

matthewpi commented 2 years ago

I'm not sure I can reproduce this. Here is how that content is highlighted for me Screenshot from 2022-07-18 10-19-21. Screenshot from 2022-07-18 10-18-11

tomquas commented 2 years ago

hmm, can i ask what theme you're using? here's a shot of my view on this...

Screen Shot 2022-07-19 at 08 53 35
francislavoie commented 2 years ago

Are you sure you're using the Caddyfile syntax highlighting? Check the bottom-right of your IDE, does it say "Caddyfile"?

Looks like the /* is being parsed as a comment, but /* is not a comment in the Caddyfile, so it must be from some other language.

tomquas commented 2 years ago

you're totally right. and i feel stupid...

the file was named 'Caddyfile-dev' and VS chose the Groovy highlighter. copied to file to 'Caddyfile' and all works well. sorry.

is there a way for the plugin to register 'Caddyfile*' for caddy-style highlighting?

matthewpi commented 2 years ago

is there a way for the plugin to register 'Caddyfile*' for caddy-style highlighting?

I believe there is a manual file association option you can set, otherwise I could add the association to the extension by default.

francislavoie commented 2 years ago

FWIW I'd appreciate having Caddyfile* work too, but it should exclude caddyfile.go and caddyfile.md which tend to come up reasonably often in the Caddy codebase and docs.