on master help sign in
Bring editor snippets, grammar and contributor docs up to date

Snippets and the TextMate grammar drop @theme, @import, @font-face, @json-ld and the removed alias attributes in favour of their replacements; CONTRIBUTING points to the LSP's docs.rs.

commitbea58d4ce376fe85aba36fa82cac59cbd8b58302 authoriko <mail@iko.soy> dateSat 26 Sep 2026, 02:21 (2 weeks ago) parent01c4421
3 files changed+23−27
CONTRIBUTING.md+5−2 editors/vscode/snippets/htmlang.json+16−23 editors/vscode/syntaxes/htmlang.tmLanguage.json+2−2
CONTRIBUTING.md+5−2
@@ -27,7 +27,9 @@ Linux, macOS, and Windows. Your change should pass all three.
2727 every file.
2828- `crates/htmlang-wasm/` — thin wrapper exposing `compile` to the web playground.
2929- `src/` — CLI, dev server, formatter, and HTML-to-hl converter.
30−- `src/bin/htmlang_lsp/` — language server binary (`htmlang-lsp`).
30+- `src/bin/htmlang_lsp/` — language server binary (`htmlang-lsp`). Its
31+ completions come from the compiler's tables; hover and completion text live
32+ in `docs.rs`.
3133- `editors/vscode/` — VS Code extension.
3234- `tests/snapshots.rs` — integration / snapshot tests for the compiler.
3335- `tests/regressions.rs` — one test per fixed bug.
@@ -42,7 +44,8 @@ Linux, macOS, and Windows. Your change should pass all three.
4244 tests alongside the code.
43452. Prefer the smallest mechanism: a component belongs in `std.hl`, an HTML
4446 element is a row in `TAGS`, and a CSS property needs no code at all. Only
45− thread a feature through the parser, codegen and LSP when it needs to be.
47+ thread a feature through the parser and codegen when it needs to be, and
48+ describe it in the LSP's `docs.rs`.
46493. Document it in `DESIGN.md` (the examples there are compiled by the tests).
4750 If it's user-facing, also update `README.md`.
48514. If it removes or renames syntax, add a rewrite to `src/upgrade.rs` and a
editors/vscode/snippets/htmlang.json+16−23
@@ -155,20 +155,14 @@
155155 "description": "Hero section with title, description, and CTA"
156156 },
157157 "Theme tokens": {
158− "prefix": "@theme",
158+ "prefix": "@let-tokens",
159159 "body": [
160− "@theme",
161− " primary ${1:#3b82f6}",
162− " secondary ${2:#10b981}",
163− " bg ${3:#ffffff}",
164− " text ${4:#1a1a2e}",
165− " spacing-sm ${5:8}",
166− " spacing-md ${6:16}",
167− " spacing-lg ${7:32}",
168− " font-body ${8:system-ui, sans-serif}",
160+ "@let --primary ${1:#3b82f6}",
161+ "@let --secondary ${2:#10b981}",
162+ "@let --radius ${3:8}",
169163 "$0"
170164 ],
171− "description": "Design token theme definition"
165+ "description": "Design tokens as CSS custom properties (use as $--primary)"
172166 },
173167 "Keyframes animation": {
174168 "prefix": "@keyframes",
@@ -183,12 +177,12 @@
183177 "description": "Keyframe animation with element usage"
184178 },
185179 "Include/Import": {
186− "prefix": "@import",
180+ "prefix": "@include",
187181 "body": [
188− "@import ${1:components.hl}",
182+ "@include ${1:components.hl}",
189183 "$0"
190184 ],
191− "description": "Import definitions from another file"
185+ "description": "Include another file (a library of @let definitions emits nothing)"
192186 },
193187 "Template inheritance": {
194188 "prefix": "@extends",
@@ -258,23 +252,22 @@
258252 "Font face": {
259253 "prefix": "@font-face",
260254 "body": [
261− "@font-face ${1:Inter} ${2:fonts/${3:inter.woff2}}",
255+ "@style",
256+ " @font-face { font-family: '${1:Inter}'; src: url('${2:fonts/inter.woff2}') format('woff2'); font-display: swap; }",
262257 "$0"
263258 ],
264− "description": "Custom font face declaration"
259+ "description": "Custom font face in an @style block"
265260 },
266261 "JSON-LD structured data": {
267262 "prefix": "@json-ld",
268263 "body": [
269− "@json-ld",
270− " {",
271− " \"@context\": \"https://schema.org\",",
272− " \"@type\": \"${1:WebPage}\",",
273− " \"name\": \"${2:Page Title}\"",
274− " }",
264+ "@head",
265+ " <script type=\"application/ld+json\">",
266+ " {\"@context\": \"https://schema.org\", \"@type\": \"${1:WebPage}\", \"name\": \"${2:Page Title}\"}",
267+ " </script>",
275268 "$0"
276269 ],
277− "description": "JSON-LD structured data block"
270+ "description": "JSON-LD structured data in @head"
278271 },
279272 "Page metadata": {
280273 "prefix": "@page-meta",
editors/vscode/syntaxes/htmlang.tmLanguage.json+2−2
@@ -87,7 +87,7 @@
8787 }
8888 },
8989 "include-directive": {
90− "match": "(@(?:include|import|extends|font-face|markdown|svg|data))\\s+(.*)",
90+ "match": "(@(?:include|extends|markdown|svg|data))\\s+(.*)",
9191 "captures": {
9292 "1": {
9393 "name": "keyword.control.directive.htmlang"
@@ -154,7 +154,7 @@
154154 },
155155 "attribute-name": {
156156 "name": "support.type.property-name.htmlang",
157− "match": "\\b(?:spacing|padding|padding-x|padding-y|width|height|min-width|max-width|min-height|max-height|center-x|center-y|align-left|align-right|align-top|align-bottom|background|color|border|rounded|bold|italic|underline|size|font|transition|cursor|opacity|text-align|line-height|overflow|position|z-index|shadow|wrap|gap-x|gap-y|gap|margin|hidden)\\b"
157+ "match": "\\b(?:spacing|padding|padding-x|padding-y|width|height|min-width|max-width|min-height|max-height|center-x|center-y|align-left|align-right|align-top|align-bottom|background|color|border|rounded|bold|italic|underline|size|font|transition|cursor|opacity|text-align|line-height|overflow|position|z-index|wrap|gap|margin|hidden)\\b"
158158 },
159159 "inline-element": {
160160 "name": "meta.inline-element.htmlang",