Skip to content

Commit

Permalink
syntax: add caddyfile-test
Browse files Browse the repository at this point in the history
Closes #299
  • Loading branch information
matthewpi committed Feb 5, 2024
1 parent 3b6a06b commit 9a294dc
Show file tree
Hide file tree
Showing 5 changed files with 283 additions and 146 deletions.
108 changes: 108 additions & 0 deletions examples/acme_server_lifetime.caddyfiletest
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
pki {
ca internal {
name "Internal"
root_cn "Internal Root Cert"
intermediate_cn "Internal Intermediate Cert"
}
ca internal-long-lived {
name "Long-lived"
root_cn "Internal Root Cert 2"
intermediate_cn "Internal Intermediate Cert 2"
}
}
}

acme-internal.example.com {
acme_server {
ca internal
}
}

acme-long-lived.example.com {
acme_server {
ca internal-long-lived
lifetime 7d
}
}
----------
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"match": [
{
"host": [
"acme-long-lived.example.com"
]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"ca": "internal-long-lived",
"handler": "acme_server",
"lifetime": 604800000000000
}
]
}
]
}
],
"terminal": true
},
{
"match": [
{
"host": [
"acme-internal.example.com"
]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"ca": "internal",
"handler": "acme_server"
}
]
}
]
}
],
"terminal": true
}
]
}
}
},
"pki": {
"certificate_authorities": {
"internal": {
"name": "Internal",
"root_common_name": "Internal Root Cert",
"intermediate_common_name": "Internal Intermediate Cert"
},
"internal-long-lived": {
"name": "Long-lived",
"root_common_name": "Internal Root Cert 2",
"intermediate_common_name": "Internal Intermediate Cert 2"
}
}
}
}
}
228 changes: 122 additions & 106 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,111 +1,127 @@
{
"name": "caddyfile-support",
"displayName": "Caddyfile Support",
"description": "Rich Caddyfile support for Visual Studio Code",
"version": "0.3.0",
"license": "MIT",
"private": true,
"main": "packages/client/dist/index.js",
"packageManager": "pnpm@8.5.0",
"icon": "media/caddy-logo.png",
"categories": [
"Programming Languages",
"Linters",
"Formatters"
],
"publisher": "matthewpi",
"author": {
"name": "Caddy Team"
},
"repository": {
"type": "git",
"name": "caddyfile-support",
"displayName": "Caddyfile Support",
"description": "Rich Caddyfile support for Visual Studio Code",
"version": "0.3.0",
"license": "MIT",
"private": true,
"main": "packages/client/dist/index.js",
"packageManager": "pnpm@8.5.0",
"icon": "media/caddy-logo.png",
"categories": [
"Programming Languages",
"Linters",
"Formatters"
],
"publisher": "matthewpi",
"author": {
"name": "Caddy Team"
},
"repository": {
"type": "git",
"url": "https://github.com/caddyserver/vscode-caddyfile"
},
"bugs": {
"url": "https://github.com/caddyserver/vscode-caddyfile/issues"
},
"engines": {
"node": ">=16.13.0",
"vscode": ">=1.67.0"
},
"scripts": {
"vscode:prepublish": "pnpm run build",
},
"bugs": {
"url": "https://github.com/caddyserver/vscode-caddyfile/issues"
},
"engines": {
"node": ">=16.13.0",
"vscode": ">=1.67.0"
},
"scripts": {
"vscode:prepublish": "pnpm run build",
"package": "mkdir dist; pnpm vsce package --no-dependencies --no-yarn --out dist/caddyfile-support.vsix",
"build": "turbo run build",
"dev": "turbo run dev --no-cache --parallel --continue",
"lint": "turbo run lint",
"clean": "turbo run clean && rimraf node_modules/.cache"
},
"devDependencies": {
"build": "turbo run build",
"dev": "turbo run dev --no-cache --parallel --continue",
"lint": "turbo run lint",
"clean": "turbo run clean && rimraf node_modules/.cache"
},
"devDependencies": {
"@vscode/vsce": "2.19.0",
"prettier": "2.8.8",
"rimraf": "5.0.0",
"turbo": "1.9.6",
"typescript": "5.0.4"
},
"extensionDependencies": [],
"activationEvents": [
"onLanguage:caddyfile",
"workspaceContains:**/Caddyfile",
"workspaceContains:**/Caddyfile*",
"workspaceContains:**/caddyfile",
"workspaceContains:**/caddyfile*",
"workspaceContains:**/*.Caddyfile",
"workspaceContains:**/*.caddyfile"
],
"contributes": {
"languages": [
{
"id": "caddyfile",
"configuration": "./language-configuration.json",
"aliases": [
"Caddyfile",
"Caddy",
"caddyfile",
"caddy"
],
"extensions": [
"Caddyfile",
"Caddyfile*",
"caddyfile",
"caddyfile*",
"*.Caddyfile",
"*.caddyfile"
]
}
],
"grammars": [
{
"language": "caddyfile",
"scopeName": "source.Caddyfile",
"path": "./syntaxes/caddyfile.tmLanguage.json"
},
{
"scopeName": "source.markdown.caddy.codeblock",
"path": "./syntaxes/caddy-markdown.tmLanguage.json",
"injectTo": [
"text.html.markdown"
],
"embeddedLanguages": {
"meta.embedded.block.caddy": "caddyfile"
}
}
],
"configurationDefaults": {
"[caddyfile]": {
"editor.insertSpaces": false,
"editor.formatOnSave": true
}
},
"configuration": {
"title": "Caddyfile",
"properties": {
"caddyfile.executable": {
"type": "string",
"default": "",
"description": "Location of the `caddy` executable to use for code formatting and linting."
}
}
}
}
"prettier": "2.8.8",
"rimraf": "5.0.0",
"turbo": "1.9.6",
"typescript": "5.0.4"
},
"extensionDependencies": [],
"activationEvents": [
"onLanguage:caddyfile",
"workspaceContains:**/Caddyfile",
"workspaceContains:**/Caddyfile*",
"workspaceContains:**/caddyfile",
"workspaceContains:**/caddyfile*",
"workspaceContains:**/*.Caddyfile",
"workspaceContains:**/*.caddyfile"
],
"contributes": {
"languages": [
{
"id": "caddyfile",
"configuration": "./language-configuration.json",
"aliases": [
"Caddyfile",
"Caddy",
"caddyfile",
"caddy"
],
"extensions": [
"Caddyfile",
"Caddyfile*",
"caddyfile",
"caddyfile*",
"*.Caddyfile",
"*.caddyfile"
]
},
{
"id": "caddyfile-test",
"configuration": "./language-configuration.json",
"aliases": [
"Caddyfile-test"
],
"extensions": [
"*.Caddyfiletest",
"*.caddyfiletest"
]
}
],
"grammars": [
{
"language": "caddyfile",
"scopeName": "source.Caddyfile",
"path": "./syntaxes/caddyfile.tmLanguage.json"
},
{
"language": "caddyfile-test",
"scopeName": "source.Caddyfile-test",
"path": "./syntaxes/caddyfile-test.tmLanguage.json"
},
{
"scopeName": "source.markdown.caddy.codeblock",
"path": "./syntaxes/caddy-markdown.tmLanguage.json",
"injectTo": [
"text.html.markdown"
],
"embeddedLanguages": {
"meta.embedded.block.caddy": "caddyfile"
}
}
],
"configurationDefaults": {
"[caddyfile]": {
"editor.insertSpaces": false,
"editor.formatOnSave": true
}
},
"configuration": {
"title": "Caddyfile",
"properties": {
"caddyfile.executable": {
"type": "string",
"default": "",
"description": "Location of the `caddy` executable to use for code formatting and linting."
}
}
}
}
}
13 changes: 3 additions & 10 deletions syntaxes/caddy-markdown.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"scopeName": "source.markdown.caddy.codeblock",
"injectionSelector": "L:text.html.markdown",

"patterns": [
{ "include": "#caddy-code-block" },
{ "include": "#caddy-d-code-block" }
],
"patterns": [{ "include": "#caddy-code-block" }, { "include": "#caddy-d-code-block" }],

"repository": {
"caddy-code-block": {
Expand Down Expand Up @@ -42,9 +39,7 @@
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
"contentName": "meta.embedded.block.caddy",

"patterns": [
{ "include": "source.Caddyfile" }
]
"patterns": [{ "include": "source.Caddyfile" }]
}
]
},
Expand Down Expand Up @@ -80,9 +75,7 @@
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
"contentName": "meta.embedded.block.caddy",

"patterns": [
{ "include": "source.Caddyfile#block_content" }
]
"patterns": [{ "include": "source.Caddyfile#block_content" }]
}
]
}
Expand Down
Loading

0 comments on commit 9a294dc

Please sign in to comment.