on master help sign in
Bring editor snippets, grammar and contributor docs up to date
bea58d4iko
CONTRIBUTING.md+5−2
@@ -27,7 +27,9 @@ Linux, macOS, and Windows. Your change should pass all three.
27 every file.
27 every file.
28- `crates/htmlang-wasm/` — thin wrapper exposing `compile` to the web playground.
28- `crates/htmlang-wasm/` — thin wrapper exposing `compile` to the web playground.
29- `src/` — CLI, dev server, formatter, and HTML-to-hl converter.
29- `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`.
31- `editors/vscode/` — VS Code extension.
33- `editors/vscode/` — VS Code extension.
32- `tests/snapshots.rs` — integration / snapshot tests for the compiler.
34- `tests/snapshots.rs` — integration / snapshot tests for the compiler.
33- `tests/regressions.rs` — one test per fixed bug.
35- `tests/regressions.rs` — one test per fixed bug.
@@ -42,7 +44,8 @@ Linux, macOS, and Windows. Your change should pass all three.
42 tests alongside the code.
44 tests alongside the code.
432. Prefer the smallest mechanism: a component belongs in `std.hl`, an HTML
452. Prefer the smallest mechanism: a component belongs in `std.hl`, an HTML
44 element is a row in `TAGS`, and a CSS property needs no code at all. Only
46 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`.
463. Document it in `DESIGN.md` (the examples there are compiled by the tests).
493. Document it in `DESIGN.md` (the examples there are compiled by the tests).
47 If it's user-facing, also update `README.md`.
50 If it's user-facing, also update `README.md`.
484. If it removes or renames syntax, add a rewrite to `src/upgrade.rs` and a
514. 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 @@
155 "description": "Hero section with title, description, and CTA"
155 "description": "Hero section with title, description, and CTA"
156 },
156 },
157 "Theme tokens": {
157 "Theme tokens": {
158− "prefix": "@theme",
158+ "prefix": "@let-tokens",
159 "body": [
159 "body": [
160− "@theme",
161− " primary ${1:#3b82f6}",
160+ "@let --primary ${1:#3b82f6}",
162− " secondary ${2:#10b981}",
161+ "@let --secondary ${2:#10b981}",
163− " bg ${3:#ffffff}",
162+ "@let --radius ${3:8}",
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}",
169 "$0"
163 "$0"
170 ],
164 ],
171− "description": "Design token theme definition"
165+ "description": "Design tokens as CSS custom properties (use as $--primary)"
172 },
166 },
173 "Keyframes animation": {
167 "Keyframes animation": {
174 "prefix": "@keyframes",
168 "prefix": "@keyframes",
@@ -183,12 +177,12 @@
183 "description": "Keyframe animation with element usage"
177 "description": "Keyframe animation with element usage"
184 },
178 },
185 "Include/Import": {
179 "Include/Import": {
186− "prefix": "@import",
180+ "prefix": "@include",
187 "body": [
181 "body": [
188− "@import ${1:components.hl}",
182+ "@include ${1:components.hl}",
189 "$0"
183 "$0"
190 ],
184 ],
191− "description": "Import definitions from another file"
185+ "description": "Include another file (a library of @let definitions emits nothing)"
192 },
186 },
193 "Template inheritance": {
187 "Template inheritance": {
194 "prefix": "@extends",
188 "prefix": "@extends",
@@ -258,23 +252,22 @@
258 "Font face": {
252 "Font face": {
259 "prefix": "@font-face",
253 "prefix": "@font-face",
260 "body": [
254 "body": [
255+ "@style",
261− "@font-face ${1:Inter} ${2:fonts/${3:inter.woff2}}",
256+ " @font-face { font-family: '${1:Inter}'; src: url('${2:fonts/inter.woff2}') format('woff2'); font-display: swap; }",
262 "$0"
257 "$0"
263 ],
258 ],
264− "description": "Custom font face declaration"
259+ "description": "Custom font face in an @style block"
265 },
260 },
266 "JSON-LD structured data": {
261 "JSON-LD structured data": {
267 "prefix": "@json-ld",
262 "prefix": "@json-ld",
268 "body": [
263 "body": [
269− "@json-ld",
264+ "@head",
270− " {",
265+ " <script type=\"application/ld+json\">",
271− " \"@context\": \"https://schema.org\",",
266+ " {\"@context\": \"https://schema.org\", \"@type\": \"${1:WebPage}\", \"name\": \"${2:Page Title}\"}",
272− " \"@type\": \"${1:WebPage}\",",
267+ " </script>",
273− " \"name\": \"${2:Page Title}\"",
274− " }",
275 "$0"
268 "$0"
276 ],
269 ],
277− "description": "JSON-LD structured data block"
270+ "description": "JSON-LD structured data in @head"
278 },
271 },
279 "Page metadata": {
272 "Page metadata": {
280 "prefix": "@page-meta",
273 "prefix": "@page-meta",
editors/vscode/syntaxes/htmlang.tmLanguage.json+2−2
@@ -87,7 +87,7 @@
87 }
87 }
88 },
88 },
89 "include-directive": {
89 "include-directive": {
90− "match": "(@(?:include|import|extends|font-face|markdown|svg|data))\\s+(.*)",
90+ "match": "(@(?:include|extends|markdown|svg|data))\\s+(.*)",
91 "captures": {
91 "captures": {
92 "1": {
92 "1": {
93 "name": "keyword.control.directive.htmlang"
93 "name": "keyword.control.directive.htmlang"
@@ -154,7 +154,7 @@
154 },
154 },
155 "attribute-name": {
155 "attribute-name": {
156 "name": "support.type.property-name.htmlang",
156 "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"
158 },
158 },
159 "inline-element": {
159 "inline-element": {
160 "name": "meta.inline-element.htmlang",
160 "name": "meta.inline-element.htmlang",