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

Make the executable optional to support containers without caddy installed #295

Closed gremo closed 1 year ago

gremo commented 1 year ago

I'd love to have a Caddy extension that is actually maintained. I've found this and I thanks for your work!

Can the caddyfile.executable be optional and extension work without the warning "Caddy was not found in your $PATH" when saving the file?

The main reason for this is when VSCode is attached to a container that doesn't have the the Caddy executable (i.e. a PHP container).

matthewpi commented 1 year ago

This is caused by the format on save functionality being enabled by default. We call out to the caddy executable to provide file formatting, hence the error message when it's not found.


If you set the following in your VSCode settings it will disable formatting on save and the not found error.

[caddyfile]: {
    "editor.formatOnSave": false,
},

On another note, I should probably update the error message to contain information about it being related to file formatting and a documentation reference.

gremo commented 1 year ago

It's ok, but formatOnSave could be a nice to have even for caddyfile. Thanks for anwering!

polarathene commented 8 months ago

On another note, I should probably update the error message to contain information about it being related to file formatting and a documentation reference.

Reminder that this doesn't seem like it was addressed.


Personally I just wanted the syntax highlighting, when that notification popped up I went to the settings to disable the format on save feature, but the extension didn't provide that UX option, requiring to follow the advice shown here with an explicit opt-out for the file extension.

Since the default value is empty, this isn't a great UX? It should perhaps default to a more subtle warning if you want to get the users attention to configure it, but I think it'd be better to not attempt to format when it'll clearly fail due to an empty value.

Those that want the format on save feature will either seek it out from documentation or exploring the extensions settings page, where it's obvious that they need to configure the path to Caddy.