4

I'm using PhpStorm to develop a project.

I have created a Caddyfile to configure my caddy server.

But PhpStorm doesn't format or highlight the code of the Caddyfile.

I know that I can change the File Type for specific file but I don't know which File Type I should choose for Caddyfile.

What is Caddyfile File type in intellij idea?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Lenny4
  • 1,215
  • 1
  • 14
  • 33
  • 2
    I don't think that Caddyfile can be associated with a known file type in IntelliJ IDEA, based on their documentation: https://caddyserver.com/docs/caddyfile/concepts. There's also no feature request to support it, so feel free to be the first at https://youtrack.jetbrains.com/newIssue – Dmitrii Sep 14 '21 at 15:05
  • It's currently marked as "won't fix": https://youtrack.jetbrains.com/issue/OC-22098 – Tyler Collier Sep 01 '23 at 03:14

1 Answers1

0

As mentioned here: https://youtrack.jetbrains.com/issue/OC-22098, Jetbrains do not plans to support Caddyfile syntax natively.

So I created a custom FileType like so:

enter image description here

List of keywords (taken from Caddyfile directicves)

abort
acme_server
basicauth
bind
encode
error
file_server
forward_auth
handle
handle_errors
handle_path
header
import
invoke
log
map
method
metrics
php_fastcgi
push
redir
request_body
request_header
respond
reverse_proxy
rewrite
root
route
skip_log
templates
tls
tracing
try_files
uri
vars

Result look like this:

enter image description here

Might be possible to create a plugin to support the Caddyfile concept and add it to https://plugins.jetbrains.com/

Lenny4
  • 1,215
  • 1
  • 14
  • 33