@excom/nucleus-quark-highlighter 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/chunked-rush-logs/nucleus-quark-highlighter.apply-exports.chunks.jsonl +1 -0
- package/.rush/temp/chunked-rush-logs/nucleus-quark-highlighter.build_package-metas.chunks.jsonl +1 -0
- package/.rush/temp/operation/apply-exports/all.log +1 -0
- package/.rush/temp/operation/apply-exports/log-chunks.jsonl +1 -0
- package/.rush/temp/operation/apply-exports/state.json +3 -0
- package/.rush/temp/operation/build_package-metas/all.log +1 -0
- package/.rush/temp/operation/build_package-metas/log-chunks.jsonl +1 -0
- package/.rush/temp/operation/build_package-metas/state.json +3 -0
- package/.rush/temp/shrinkwrap-deps.json +31 -0
- package/.vscodeignore +10 -0
- package/LICENSE.md +1 -0
- package/icons/marketplace-icon.png +0 -0
- package/icons/marketplace-icon.svg +6 -0
- package/icons/quark-file.svg +3 -0
- package/package.json +127 -0
- package/quark.configuration.json +35 -0
- package/rush-logs/nucleus-quark-highlighter.apply-exports.cache.log +1 -0
- package/rush-logs/nucleus-quark-highlighter.apply-exports.log +1 -0
- package/rush-logs/nucleus-quark-highlighter.build_package-metas.cache.log +1 -0
- package/rush-logs/nucleus-quark-highlighter.build_package-metas.log +1 -0
- package/scripts/build-extension.mjs +24 -0
- package/scripts/package-vsix.mjs +53 -0
- package/shiki.mjs +35 -0
- package/src/extension.ts +107 -0
- package/support/docs/README.md +76 -0
- package/support/package-meta.json +44 -0
- package/syntaxes/html-custom-elements.tmLanguage.json +82 -0
- package/syntaxes/quark.tmLanguage.json +1454 -0
- package/tsconfig.json +8 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: cd \"$RUSH_PROJECT_FOLDER\" && node ../heft-rig/scripts/apply-exports.mjs \n"}
|
package/.rush/temp/chunked-rush-logs/nucleus-quark-highlighter.build_package-metas.chunks.jsonl
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs \n"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Invoking: cd "$RUSH_PROJECT_FOLDER" && node ../heft-rig/scripts/apply-exports.mjs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: cd \"$RUSH_PROJECT_FOLDER\" && node ../heft-rig/scripts/apply-exports.mjs \n"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs \n"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"../../packages/nucleus-quark-highlighter": "../../packages/nucleus-quark-highlighter:CLYavdzNRF0GlQqRRtZ4IpHQhBTGSmS0qSnBNkdp3Ig=:",
|
|
3
|
+
"@esbuild/aix-ppc64@0.28.2": "@esbuild/aix-ppc64@0.28.2:EMM/YcOSZm2KdqOI7JV/ZBP/kfIUAGRs+ac2MTNUNSU=:",
|
|
4
|
+
"@esbuild/android-arm64@0.28.2": "@esbuild/android-arm64@0.28.2:DKCxOLbsLt7L1pN/jQYTCxJsXY+p9WYFTXJHMXGA5WM=:",
|
|
5
|
+
"@esbuild/android-arm@0.28.2": "@esbuild/android-arm@0.28.2:xUNq1+kXskMVzUzPRI5ms9M5CgClbWEq/P/0sQHsSP0=:",
|
|
6
|
+
"@esbuild/android-x64@0.28.2": "@esbuild/android-x64@0.28.2:8o3ADYLKarKfGViyaXcHE2iBvjL0og5LegLkZATRKVo=:",
|
|
7
|
+
"@esbuild/darwin-arm64@0.28.2": "@esbuild/darwin-arm64@0.28.2:PzMv5Mh7G2N0ZVnohry0Sqomu1rCGtEaxiI4dJTewb0=:",
|
|
8
|
+
"@esbuild/darwin-x64@0.28.2": "@esbuild/darwin-x64@0.28.2:MLT/aDcfGo8xCB6u+zMlF3oe/6A1/doCvbK0NU8OUJ4=:",
|
|
9
|
+
"@esbuild/freebsd-arm64@0.28.2": "@esbuild/freebsd-arm64@0.28.2:MQuX8jRJondQ1hY1NH8LvojklPEO2B7JisMEGgoEp90=:",
|
|
10
|
+
"@esbuild/freebsd-x64@0.28.2": "@esbuild/freebsd-x64@0.28.2:0agX9W6LfLvw7bOXCyDX+qeEEx+O9wGSQejQPWM2xIs=:",
|
|
11
|
+
"@esbuild/linux-arm64@0.28.2": "@esbuild/linux-arm64@0.28.2:FAEI/lSwtrUNBYeEeyhO5OaalMLRDiZ8LBfva3jcn1k=:",
|
|
12
|
+
"@esbuild/linux-arm@0.28.2": "@esbuild/linux-arm@0.28.2:OrkKPAD0/M/VjvKFMh/wk2+uxtFwQ2igfNFYfk36TNA=:",
|
|
13
|
+
"@esbuild/linux-ia32@0.28.2": "@esbuild/linux-ia32@0.28.2:qYSnA4fleBEpkOE4rp1qAZSxfodl4WJBB8aEB+1H01s=:",
|
|
14
|
+
"@esbuild/linux-loong64@0.28.2": "@esbuild/linux-loong64@0.28.2:eUrxoVuWCtWEKPTUtIGxnpG1/Y4JWPVTSu42POLdjG8=:",
|
|
15
|
+
"@esbuild/linux-mips64el@0.28.2": "@esbuild/linux-mips64el@0.28.2:5YctABnidMC7/9x/B6F65tX2gTC6u2LzcHlmwNhoeKc=:",
|
|
16
|
+
"@esbuild/linux-ppc64@0.28.2": "@esbuild/linux-ppc64@0.28.2:wG07FlZEkA9Hpnka22RzHHDuhyVpnPkux9C8WksOitg=:",
|
|
17
|
+
"@esbuild/linux-riscv64@0.28.2": "@esbuild/linux-riscv64@0.28.2:5wv+bG8qZIjVhBPkiKPZdxu7wyXx89vJcgxUrlXaFLw=:",
|
|
18
|
+
"@esbuild/linux-s390x@0.28.2": "@esbuild/linux-s390x@0.28.2:/PdqhxC2KwhZFhKR2V5GTm+9uK5KlFA53a+8w6zzCOE=:",
|
|
19
|
+
"@esbuild/linux-x64@0.28.2": "@esbuild/linux-x64@0.28.2:9jqLdOKXRimXSyn7OQAFunA+5M53I8vVJWkuPJuvFIQ=:",
|
|
20
|
+
"@esbuild/netbsd-arm64@0.28.2": "@esbuild/netbsd-arm64@0.28.2:jvv5D2pK1VyBSfnuCSn1xblQMMh2gkXSHtdobw4kVWk=:",
|
|
21
|
+
"@esbuild/netbsd-x64@0.28.2": "@esbuild/netbsd-x64@0.28.2:GL2RDD5qQTPyVx1FfDZWMr7zRbSfDAswyqLJ2naKnhw=:",
|
|
22
|
+
"@esbuild/openbsd-arm64@0.28.2": "@esbuild/openbsd-arm64@0.28.2:y/GYc5NhweVkDCFFbfaDAYiN7zk1T5T89s3XtXzR5GQ=:",
|
|
23
|
+
"@esbuild/openbsd-x64@0.28.2": "@esbuild/openbsd-x64@0.28.2:qj4Y/W0eEQ4FQEpOUGErKfvy080WenSnsFj9HR5ncwY=:",
|
|
24
|
+
"@esbuild/openharmony-arm64@0.28.2": "@esbuild/openharmony-arm64@0.28.2:wvBkvEBZtcp+QFIHtbRQCCx5ARkfTcdZROh5SdPMIKU=:",
|
|
25
|
+
"@esbuild/sunos-x64@0.28.2": "@esbuild/sunos-x64@0.28.2:JZYYva4FUv7TuFqaW9G4plR0W70/a0v5eTpPfbeLZx0=:",
|
|
26
|
+
"@esbuild/win32-arm64@0.28.2": "@esbuild/win32-arm64@0.28.2:4TUBnHrLd6stf27wjAc6Ypzo09zt/9anox28AHQWQiQ=:",
|
|
27
|
+
"@esbuild/win32-ia32@0.28.2": "@esbuild/win32-ia32@0.28.2:53jfVpnP+jcPi1yW8zoaRdwGg+UC01hojZMwSoUlO3E=:",
|
|
28
|
+
"@esbuild/win32-x64@0.28.2": "@esbuild/win32-x64@0.28.2:FnuXaWDAODGYCui3N7LVyh+KCYwrNrxGNAPgq3K+fuw=:",
|
|
29
|
+
"@types/vscode@1.125.0": "@types/vscode@1.125.0:89oVF6ckf++rv0MytcdWOUaiKFrXPBF48C4ufd059Zo=:",
|
|
30
|
+
"esbuild@0.28.2": "esbuild@0.28.2:ifYVvs8wKiOsrhcIJX/fCHaoTrpM3PMruwKOWmgb/iQ=:"
|
|
31
|
+
}
|
package/.vscodeignore
ADDED
package/LICENSE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MIT
|
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="128" height="128" viewBox="0 0 128 128" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="128" height="128" rx="24" fill="#1F2430"/>
|
|
3
|
+
<g transform="translate(29 16)">
|
|
4
|
+
<path d="M14.7974 2.75049C16.3162 0.120058 19.6795 -0.780888 22.3101 0.737793L51.7554 17.7378C68.2561 27.2647 73.9097 48.3639 64.3833 64.8647C59.8431 72.7287 52.6732 78.1266 44.6265 80.5942L52.1997 84.9673C54.8301 86.4861 55.732 89.8494 54.2134 92.48C52.6946 95.1105 49.3303 96.0113 46.6997 94.4927L17.2554 77.4927C0.75456 67.9658 -4.89914 46.8667 4.62744 30.3657C9.16746 22.5023 16.3361 17.103 24.3823 14.6353L16.8101 10.2632C14.1798 8.74427 13.2787 5.38094 14.7974 2.75049ZM46.2554 27.2642C35.0155 20.7748 20.6432 24.626 14.1538 35.8657C7.76615 46.9299 11.3978 61.029 22.2339 67.6567L22.7554 67.9673L23.2847 68.2632C34.4426 74.3336 48.469 70.429 54.8569 59.3647C61.3458 48.125 57.4948 33.7535 46.2554 27.2642ZM23.8979 37.0083C29.7558 31.1505 39.254 31.1505 45.1118 37.0083C50.9696 42.8661 50.9696 52.3643 45.1118 58.2222C39.254 64.08 29.7558 64.08 23.8979 58.2222C18.0401 52.3643 18.0401 42.8662 23.8979 37.0083Z" fill="#4FC9B0"/>
|
|
5
|
+
</g>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="128" height="128" viewBox="-29 -16 128 128" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M14.7974 2.75049C16.3162 0.120058 19.6795 -0.780888 22.3101 0.737793L51.7554 17.7378C68.2561 27.2647 73.9097 48.3639 64.3833 64.8647C59.8431 72.7287 52.6732 78.1266 44.6265 80.5942L52.1997 84.9673C54.8301 86.4861 55.732 89.8494 54.2134 92.48C52.6946 95.1105 49.3303 96.0113 46.6997 94.4927L17.2554 77.4927C0.75456 67.9658 -4.89914 46.8667 4.62744 30.3657C9.16746 22.5023 16.3361 17.103 24.3823 14.6353L16.8101 10.2632C14.1798 8.74427 13.2787 5.38094 14.7974 2.75049ZM46.2554 27.2642C35.0155 20.7748 20.6432 24.626 14.1538 35.8657C7.76615 46.9299 11.3978 61.029 22.2339 67.6567L22.7554 67.9673L23.2847 68.2632C34.4426 74.3336 48.469 70.429 54.8569 59.3647C61.3458 48.125 57.4948 33.7535 46.2554 27.2642ZM23.8979 37.0083C29.7558 31.1505 39.254 31.1505 45.1118 37.0083C50.9696 42.8661 50.9696 52.3643 45.1118 58.2222C39.254 64.08 29.7558 64.08 23.8979 58.2222C18.0401 52.3643 18.0401 42.8662 23.8979 37.0083Z" fill="#4FC9B0"/>
|
|
3
|
+
</svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@excom/nucleus-quark-highlighter",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"displayName": "Nucleus & Quark Syntax Highlighter",
|
|
5
|
+
"description": "VS Code syntax highlighting for Quark sheets and Nucleus-style HTML",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=24.13.0",
|
|
9
|
+
"vscode": "^1.74.0"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"dependencies": {},
|
|
13
|
+
"peerDependencies": {},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/vscode": "^1.74.0",
|
|
16
|
+
"esbuild": "^0.28.2",
|
|
17
|
+
"@excom/heft-rig": "^0.1.0",
|
|
18
|
+
"@excom/quark-formatter": "^0.1.0"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/excom-dev/nucleus.git",
|
|
23
|
+
"directory": "packages/nucleus-quark-highlighter"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/excom-dev/nucleus/tree/main/packages/nucleus-quark-highlighter/support/docs/README.md",
|
|
26
|
+
"bugs": "https://github.com/excom-dev/nucleus/issues",
|
|
27
|
+
"keywords": [
|
|
28
|
+
"nucleus-quark-highlighter",
|
|
29
|
+
"tool",
|
|
30
|
+
"nucleus",
|
|
31
|
+
"quark",
|
|
32
|
+
"nucleus-syntax-highlighting",
|
|
33
|
+
"quark-syntax-highlighting",
|
|
34
|
+
"syntax-highlighting",
|
|
35
|
+
"vscode-extension"
|
|
36
|
+
],
|
|
37
|
+
"excom": {
|
|
38
|
+
"packageType": "tool"
|
|
39
|
+
},
|
|
40
|
+
"activationEvents": [
|
|
41
|
+
"onLanguage:quark"
|
|
42
|
+
],
|
|
43
|
+
"categories": [
|
|
44
|
+
"Programming Languages",
|
|
45
|
+
"Formatters"
|
|
46
|
+
],
|
|
47
|
+
"contributes": {
|
|
48
|
+
"languages": [
|
|
49
|
+
{
|
|
50
|
+
"id": "quark",
|
|
51
|
+
"aliases": [
|
|
52
|
+
"Quark",
|
|
53
|
+
"quark"
|
|
54
|
+
],
|
|
55
|
+
"extensions": [
|
|
56
|
+
".quark"
|
|
57
|
+
],
|
|
58
|
+
"configuration": "./quark.configuration.json",
|
|
59
|
+
"icon": {
|
|
60
|
+
"light": "./icons/quark-file.svg",
|
|
61
|
+
"dark": "./icons/quark-file.svg"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"commands": [
|
|
66
|
+
{
|
|
67
|
+
"command": "quark.formatSheets",
|
|
68
|
+
"title": "Quark: Format <quark-sheet> blocks"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"keybindings": [
|
|
72
|
+
{
|
|
73
|
+
"command": "editor.action.commentLine",
|
|
74
|
+
"key": "ctrl+/",
|
|
75
|
+
"mac": "cmd+/",
|
|
76
|
+
"when": "editorTextFocus && editorLangId == 'quark'"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"command": "editor.action.blockComment",
|
|
80
|
+
"key": "shift+alt+a",
|
|
81
|
+
"mac": "shift+alt+a",
|
|
82
|
+
"when": "editorTextFocus && editorLangId == 'quark'"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"command": "editor.action.formatDocument",
|
|
86
|
+
"key": "shift+alt+f",
|
|
87
|
+
"mac": "shift+alt+f",
|
|
88
|
+
"when": "editorTextFocus && editorLangId == 'quark'"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"grammars": [
|
|
92
|
+
{
|
|
93
|
+
"scopeName": "injection.html.custom-elements",
|
|
94
|
+
"path": "./syntaxes/html-custom-elements.tmLanguage.json",
|
|
95
|
+
"injectTo": [
|
|
96
|
+
"text.html.derivative",
|
|
97
|
+
"text.html.basic"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"language": "quark",
|
|
102
|
+
"scopeName": "source.quark",
|
|
103
|
+
"path": "./syntaxes/quark.tmLanguage.json"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"exports": {
|
|
108
|
+
"./shiki": "./shiki.mjs",
|
|
109
|
+
"./syntaxes/*": "./syntaxes/*"
|
|
110
|
+
},
|
|
111
|
+
"icon": "icons/marketplace-icon.png",
|
|
112
|
+
"main": "./dist/extension.cjs",
|
|
113
|
+
"publisher": "excom-dev",
|
|
114
|
+
"scripts": {
|
|
115
|
+
"build": "node scripts/build-extension.mjs",
|
|
116
|
+
"build:watch": "node -e \"console.log('nucleus-quark-highlighter: no build watch')",
|
|
117
|
+
"format": "node -e \"console.log('nucleus-quark-highlighter: no format')\"",
|
|
118
|
+
"test": "node -e \"console.log('nucleus-quark-highlighter: no tests')\"",
|
|
119
|
+
"coverage": "node -e \"console.log('nucleus-quark-highlighter: no tests')\"",
|
|
120
|
+
"retest": "node -e \"console.log('nucleus-quark-highlighter: no retests')\"",
|
|
121
|
+
"recoverage": "node -e \"console.log('nucleus-quark-highlighter: no recoverage')\"",
|
|
122
|
+
"reformat": "node -e \"console.log('nucleus-quark-highlighter: no reformat')\"",
|
|
123
|
+
"build:package-metas": "node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs",
|
|
124
|
+
"package:vsix": "node scripts/package-vsix.mjs",
|
|
125
|
+
"publish:vsix": "node scripts/package-vsix.mjs --publish"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"comments": {
|
|
3
|
+
"blockComment": ["/*", "*/"]
|
|
4
|
+
},
|
|
5
|
+
"brackets": [
|
|
6
|
+
["{", "}"],
|
|
7
|
+
["[", "]"],
|
|
8
|
+
["(", ")"]
|
|
9
|
+
],
|
|
10
|
+
"autoClosingPairs": [
|
|
11
|
+
{ "open": "{", "close": "}", "notIn": ["string", "comment"] },
|
|
12
|
+
{ "open": "[", "close": "]", "notIn": ["string", "comment"] },
|
|
13
|
+
{ "open": "(", "close": ")", "notIn": ["string", "comment"] },
|
|
14
|
+
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] },
|
|
15
|
+
{ "open": "'", "close": "'", "notIn": ["string", "comment"] }
|
|
16
|
+
],
|
|
17
|
+
"surroundingPairs": [
|
|
18
|
+
["{", "}"],
|
|
19
|
+
["[", "]"],
|
|
20
|
+
["(", ")"],
|
|
21
|
+
["\"", "\""],
|
|
22
|
+
["'", "'"]
|
|
23
|
+
],
|
|
24
|
+
"folding": {
|
|
25
|
+
"markers": {
|
|
26
|
+
"start": "^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/",
|
|
27
|
+
"end": "^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"indentationRules": {
|
|
31
|
+
"increaseIndentPattern": "(^.*\\{[^}]*$)",
|
|
32
|
+
"decreaseIndentPattern": "^\\s*\\}"
|
|
33
|
+
},
|
|
34
|
+
"wordPattern": "(#?-?\\d*\\.\\d\\w*%?)|(::?[\\w-]*(?=[^,{;]*[,{]))|(([@$#.])?[\\w-?]+%?|[@#$.])"
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Project does not have a rush-project.json configuration file, or one provided by a rig, so it does not support caching.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Invoking: cd "$RUSH_PROJECT_FOLDER" && node ../heft-rig/scripts/apply-exports.mjs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Project does not have a rush-project.json configuration file, or one provided by a rig, so it does not support caching.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { build } from "esbuild";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
const pkgRoot = path.resolve(
|
|
6
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
7
|
+
"..",
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
/* Bundle the extension entry (plus `@excom/quark-formatter` and its
|
|
11
|
+
parser) into one self-contained CJS file so the .vsix has no runtime
|
|
12
|
+
node_modules. */
|
|
13
|
+
await build({
|
|
14
|
+
entryPoints: [path.join(pkgRoot, "src/extension.ts")],
|
|
15
|
+
bundle: true,
|
|
16
|
+
platform: "node",
|
|
17
|
+
format: "cjs",
|
|
18
|
+
target: "node16",
|
|
19
|
+
external: ["vscode"],
|
|
20
|
+
outfile: path.join(pkgRoot, "dist/extension.cjs"),
|
|
21
|
+
minify: true,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
console.log("nucleus-quark-highlighter: built dist/extension.cjs");
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
const pkgRoot = path.resolve(
|
|
7
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
8
|
+
"..",
|
|
9
|
+
);
|
|
10
|
+
const manifestPath = path.join(pkgRoot, "package.json");
|
|
11
|
+
const publish = process.argv.includes("--publish");
|
|
12
|
+
|
|
13
|
+
/* vsce rejects npm-scoped names; rush requires them. Unscope the
|
|
14
|
+
manifest for packaging, then restore it. The .vsix already carries
|
|
15
|
+
the unscoped name, so publish from the file needs no second rewrite. */
|
|
16
|
+
const original = await readFile(manifestPath, "utf8");
|
|
17
|
+
const manifest = JSON.parse(original);
|
|
18
|
+
manifest.name = manifest.name.replace(/^@[^/]+\//, "");
|
|
19
|
+
const vsixFile = `${manifest.name}-${manifest.version}.vsix`;
|
|
20
|
+
|
|
21
|
+
const npx = (args) =>
|
|
22
|
+
execFileSync("npx", ["--yes", ...args], { cwd: pkgRoot, stdio: "inherit" });
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
execFileSync("node", [path.join(pkgRoot, "scripts/build-extension.mjs")], {
|
|
26
|
+
cwd: pkgRoot,
|
|
27
|
+
stdio: "inherit",
|
|
28
|
+
});
|
|
29
|
+
await writeFile(manifestPath, JSON.stringify(manifest, null, 2) + "\n");
|
|
30
|
+
npx([
|
|
31
|
+
"@vscode/vsce",
|
|
32
|
+
"package",
|
|
33
|
+
"--allow-missing-repository",
|
|
34
|
+
"--skip-license",
|
|
35
|
+
"--out",
|
|
36
|
+
vsixFile,
|
|
37
|
+
]);
|
|
38
|
+
} finally {
|
|
39
|
+
await writeFile(manifestPath, original);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (publish) {
|
|
43
|
+
// Marketplace (VS Code) needs `VSCE_PAT`; Open VSX (Cursor, VSCodium,
|
|
44
|
+
// Windsurf, ...) needs `OVSX_PAT`. Both tools read those env vars.
|
|
45
|
+
const missing = ["VSCE_PAT", "OVSX_PAT"].filter((k) => !process.env[k]);
|
|
46
|
+
if (missing.length) {
|
|
47
|
+
console.error(`package-vsix: set ${missing.join(" and ")} to publish`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
npx(["@vscode/vsce", "publish", "--packagePath", vsixFile]);
|
|
51
|
+
npx(["ovsx", "publish", vsixFile]);
|
|
52
|
+
console.log(`nucleus-quark-highlighter: published ${vsixFile}`);
|
|
53
|
+
}
|
package/shiki.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shiki `LanguageRegistration` wrappers for the TextMate grammars here.
|
|
3
|
+
* Pass to `createHighlighter({ langs: [...shikiLangs] })`.
|
|
4
|
+
*/
|
|
5
|
+
// Keep each grammar import on one line with no trailing comma inside the
|
|
6
|
+
// attribute clause: es-module-lexer (used by Vite dev) does not recognise
|
|
7
|
+
// `with { type: "json", }` as import attributes, so Vite leaves the clause
|
|
8
|
+
// in place while serving the JSON as a JS module, and the browser then
|
|
9
|
+
// rejects the mismatched MIME type (breaking every `@use "/shell"` sheet).
|
|
10
|
+
// prettier-ignore
|
|
11
|
+
import quarkGrammar from "./syntaxes/quark.tmLanguage.json" with { type: "json" };
|
|
12
|
+
// prettier-ignore
|
|
13
|
+
import htmlCustomElementsGrammar from "./syntaxes/html-custom-elements.tmLanguage.json" with { type: "json" };
|
|
14
|
+
|
|
15
|
+
/** Standalone Quark (`.quark` / `quark` fences). */
|
|
16
|
+
export const quark = {
|
|
17
|
+
...quarkGrammar,
|
|
18
|
+
name: "quark",
|
|
19
|
+
displayName: "Quark",
|
|
20
|
+
embeddedLangs: ["css"],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Injection for Nucleus-style HTML: kebab custom elements / attrs, plus
|
|
25
|
+
* Quark inside `<quark-sheet>`. Applied when `html` / `html-derivative`
|
|
26
|
+
* is highlighted.
|
|
27
|
+
*/
|
|
28
|
+
export const htmlCustomElements = {
|
|
29
|
+
...htmlCustomElementsGrammar,
|
|
30
|
+
name: "html-custom-elements",
|
|
31
|
+
injectTo: ["text.html.basic", "text.html.derivative"],
|
|
32
|
+
embeddedLangs: ["quark"],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const shikiLangs = [quark, htmlCustomElements];
|
package/src/extension.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
import { format } from "@excom/quark-formatter";
|
|
3
|
+
|
|
4
|
+
const SHEET_PATTERN = /(<quark-sheet\b[^>]*>)([\s\S]*?)(?=<\/quark-sheet>)/gi;
|
|
5
|
+
|
|
6
|
+
export function activate(context: vscode.ExtensionContext): void {
|
|
7
|
+
context.subscriptions.push(
|
|
8
|
+
vscode.languages.registerDocumentFormattingEditProvider("quark", {
|
|
9
|
+
provideDocumentFormattingEdits(document, options) {
|
|
10
|
+
const source = document.getText();
|
|
11
|
+
try {
|
|
12
|
+
const formatted = format(source, {
|
|
13
|
+
indent: indentUnit(options),
|
|
14
|
+
});
|
|
15
|
+
if (formatted === source) return [];
|
|
16
|
+
const fullRange = new vscode.Range(
|
|
17
|
+
document.positionAt(0),
|
|
18
|
+
document.positionAt(source.length),
|
|
19
|
+
);
|
|
20
|
+
return [vscode.TextEdit.replace(fullRange, formatted)];
|
|
21
|
+
} catch (error) {
|
|
22
|
+
// Parse error: leave the document alone rather than mangle it.
|
|
23
|
+
vscode.window.setStatusBarMessage(
|
|
24
|
+
`Quark: cannot format (${errorMessage(error)})`,
|
|
25
|
+
5000,
|
|
26
|
+
);
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
vscode.commands.registerCommand(
|
|
32
|
+
"quark.formatSheets",
|
|
33
|
+
formatQuarkSheetBlocks,
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function indentUnit(options: vscode.FormattingOptions): string {
|
|
39
|
+
return options.insertSpaces ? " ".repeat(options.tabSize) : "\t";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function errorMessage(error: unknown): string {
|
|
43
|
+
return error instanceof Error ? error.message : String(error);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Format every inline `<quark-sheet>` in the active HTML editor,
|
|
48
|
+
* indented one level past the tag.
|
|
49
|
+
*/
|
|
50
|
+
async function formatQuarkSheetBlocks(): Promise<void> {
|
|
51
|
+
const editor = vscode.window.activeTextEditor;
|
|
52
|
+
if (!editor) return;
|
|
53
|
+
const { document } = editor;
|
|
54
|
+
const tabSize = Number(editor.options.tabSize) || 2;
|
|
55
|
+
const indent =
|
|
56
|
+
editor.options.insertSpaces === false ? "\t" : " ".repeat(tabSize);
|
|
57
|
+
|
|
58
|
+
const text = document.getText();
|
|
59
|
+
const edits: Array<{ start: number; end: number; text: string }> = [];
|
|
60
|
+
const failures: string[] = [];
|
|
61
|
+
|
|
62
|
+
for (const match of text.matchAll(SHEET_PATTERN)) {
|
|
63
|
+
const inner = match[2];
|
|
64
|
+
if (!inner.trim()) continue;
|
|
65
|
+
const innerStart = match.index + match[1].length;
|
|
66
|
+
// Indentation of the line the opening tag sits on.
|
|
67
|
+
const lineStart = text.lastIndexOf("\n", match.index) + 1;
|
|
68
|
+
const baseIndent = /^[ \t]*/.exec(text.slice(lineStart, match.index))![0];
|
|
69
|
+
try {
|
|
70
|
+
const body = format(inner, { indent })
|
|
71
|
+
.trimEnd()
|
|
72
|
+
.split("\n")
|
|
73
|
+
.map((line) => (line ? baseIndent + indent + line : line))
|
|
74
|
+
.join("\n");
|
|
75
|
+
const replacement = `\n${body}\n${baseIndent}`;
|
|
76
|
+
if (replacement !== inner) {
|
|
77
|
+
edits.push({
|
|
78
|
+
start: innerStart,
|
|
79
|
+
end: innerStart + inner.length,
|
|
80
|
+
text: replacement,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
} catch (error) {
|
|
84
|
+
failures.push(errorMessage(error));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (edits.length) {
|
|
89
|
+
await editor.edit((builder) => {
|
|
90
|
+
for (const edit of edits) {
|
|
91
|
+
builder.replace(
|
|
92
|
+
new vscode.Range(
|
|
93
|
+
document.positionAt(edit.start),
|
|
94
|
+
document.positionAt(edit.end),
|
|
95
|
+
),
|
|
96
|
+
edit.text,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const summary = failures.length
|
|
102
|
+
? `Quark: formatted ${edits.length} sheet(s), ${failures.length} failed (${failures[0]})`
|
|
103
|
+
: `Quark: formatted ${edits.length} sheet(s)`;
|
|
104
|
+
vscode.window.setStatusBarMessage(summary, 5000);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function deactivate(): void {}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# nucleus-quark-highlighter
|
|
2
|
+
|
|
3
|
+
Quark sheets and Nucleus-style HTML, highlighted and formatted in VS Code / Cursor — the same grammar that colors every code block on this site.
|
|
4
|
+
|
|
5
|
+
The **Nucleus & Quark Syntax Highlighter** extension adds a Quark language for `.quark` files, highlights Quark inside `<quark-sheet>` in HTML, and gives custom elements and dashed attributes their own color so Adapters and their state stand apart from native markup. Tags, custom tags, attributes and custom attributes share one palette in both grammars, so a sheet and the markup it orchestrates read the same way.
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<provider-fetch src-url="/api/todos" should-fetch>
|
|
9
|
+
<ul></ul>
|
|
10
|
+
<quark-sheet>
|
|
11
|
+
provider-fetch[is-success] {
|
|
12
|
+
$todos: prop("provision").body;
|
|
13
|
+
ul { content: iterate($todos); }
|
|
14
|
+
}
|
|
15
|
+
</quark-sheet>
|
|
16
|
+
</provider-fetch>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **Quark language** `.quark` files with CSS-familiar highlighting, folding, bracket matching and `/* */` comments; Quark's at-rules — `@use`, `@scope`, `@on` with its event list, `@dispatch` / `@command`, `@view-transition`, `@delay`, `@warn` / `@debug` / `@error` — color their names, options groups, durations, messages and blocks
|
|
22
|
+
- **Quark's language, nothing else** Quark is not SCSS and not a CSS superset: every other at-rule (`@media`, `@mixin`, `@if`, `@keyframes`, …) and `%placeholder` selectors are colored as errors, because Quark's parser rejects them
|
|
23
|
+
- **Inline sheets** Quark inside `<quark-sheet>` in HTML is highlighted as Quark
|
|
24
|
+
- **Custom elements stand out** Dashed tags / dashed attributes get their own color in HTML and in Quark selectors; a dashed tag keeps that color wherever it appears in a selector — attribute-qualified, inside `:is()` / `:not()` / `:has()`, or before a pseudo-class or pseudo-element
|
|
25
|
+
- **Format Document** `.quark` files format with `@excom/quark-formatter` (`Shift+Alt+F`)
|
|
26
|
+
- **Format inline sheets** `Quark: Format <quark-sheet> blocks` formats every sheet in the open HTML file
|
|
27
|
+
- **File icon** `.quark` files carry the Quark icon in the explorer and tabs
|
|
28
|
+
- **Shiki grammar** `@excom/nucleus-quark-highlighter/shiki` highlights Quark / Nucleus HTML in docs and static sites
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
Install **Nucleus & Quark Syntax Highlighter** from the editor's Extensions view, or from the registries directly:
|
|
33
|
+
|
|
34
|
+
- **VS Code** — [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=excom-dev.nucleus-quark-highlighter), or `ext install excom-dev.nucleus-quark-highlighter` in Quick Open
|
|
35
|
+
- **Cursor / VSCodium / Windsurf** — [Open VSX](https://open-vsx.org/extension/excom-dev/nucleus-quark-highlighter)
|
|
36
|
+
|
|
37
|
+
To install a build by hand, download `nucleus-quark-highlighter-<version>.vsix` from the [GitHub releases](https://github.com/excom-dev/nucleus/releases) and run `code --install-extension <file>` (`cursor --install-extension` in Cursor).
|
|
38
|
+
|
|
39
|
+
For docs sites and build tooling the grammar is also on npm:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install @excom/nucleus-quark-highlighter
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
Open a `.quark` file and the language mode is **Quark**. Open any HTML file and `<quark-sheet>` bodies, custom elements and dashed attributes are colored without further setup.
|
|
48
|
+
|
|
49
|
+
### Formatting
|
|
50
|
+
|
|
51
|
+
- **`.quark` files** — Format Document (`Shift+Alt+F`, or format-on-save) reformats the whole file
|
|
52
|
+
- **Inline sheets in HTML** — run **Quark: Format `<quark-sheet>` blocks** from the Command Palette; every sheet body in the active file is formatted and re-indented one level past its tag
|
|
53
|
+
|
|
54
|
+
Inline sheets need the command because VS Code's HTML formatter only formats the `<style>` / `<script>` bodies it knows about and offers no hook for custom tags. A sheet that does not parse is left untouched and the reason appears in the status bar.
|
|
55
|
+
|
|
56
|
+
### Shortcuts
|
|
57
|
+
|
|
58
|
+
`Cmd+/` (`Ctrl+/`) and `Shift+Alt+A` both toggle `/* */` comments — Quark has no `//` line comments, so a sheet stays tokenizable by a CSS engine.
|
|
59
|
+
|
|
60
|
+
### Highlighting with Shiki
|
|
61
|
+
|
|
62
|
+
The extension's TextMate grammars are exported for [Shiki](https://shiki.style):
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
import { createHighlighter } from "shiki";
|
|
66
|
+
import { shikiLangs } from "@excom/nucleus-quark-highlighter/shiki";
|
|
67
|
+
|
|
68
|
+
const highlighter = await createHighlighter({
|
|
69
|
+
themes: ["github-light", "github-dark"],
|
|
70
|
+
langs: ["html", "css", ...shikiLangs],
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
highlighter.codeToHtml(source, { lang: "quark", theme: "github-dark" });
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`quark` highlights standalone sheets. `html-custom-elements` is an injection: once registered, every `html` block gets custom-element / dashed-attribute coloring and Quark highlighting inside `<quark-sheet>`. Load `css` alongside them; the Quark grammar embeds it.
|