@zenithbuild/language 0.6.1 → 0.7.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/README.md +15 -49
- package/language-configuration.json +52 -120
- package/out/extension.cjs +115 -0
- package/out/server.mjs +931 -0
- package/package.json +72 -95
- package/snippets/zenith.code-snippets +83 -47
- package/syntaxes/zenith.tmLanguage.json +220 -714
- package/.github/workflows/release.yml +0 -261
- package/.releaserc.json +0 -73
- package/.vscodeignore +0 -9
- package/CHANGELOG.md +0 -90
- package/RELEASE_NOTES.md +0 -30
- package/RELEASE_NOTES_v0.6.0.md +0 -26
- package/assets/logo.png +0 -0
- package/bun.lock +0 -91
- package/icons/zen.icns +0 -0
- package/icons/zenith-icon-theme.json +0 -14
- package/scripts/build.js +0 -141
- package/scripts/release.ts +0 -571
- package/src/extension.ts +0 -147
- package/test/fixtures/grammar-test.zen +0 -36
- package/test/grammar-snippets.spec.js +0 -73
- package/tsconfig.json +0 -26
package/README.md
CHANGED
|
@@ -1,57 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zenithbuild/language
|
|
2
2
|
|
|
3
|
-
VS Code
|
|
3
|
+
Canonical Zenith VS Code language support for `.zen` files.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package provides:
|
|
6
|
+
- the `zenith` language id
|
|
7
|
+
- the `text.html.zenith` TextMate grammar
|
|
8
|
+
- canonical Zenith snippets
|
|
9
|
+
- VS Code integration with `@zenithbuild/language-server`
|
|
10
|
+
- compiler-backed diagnostics plus the first `ZEN-DOM-*` quick fixes
|
|
11
|
+
- doc-backed hover and completion coverage for canonical Zenith APIs and documented `on:*` events
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Features
|
|
10
|
-
|
|
11
|
-
- **Syntax Highlighting**: Expertly crafted TextMate grammar for `.zen` files, including embedded JavaScript, TypeScript, and CSS.
|
|
12
|
-
- **IntelliSense**: Smart completions for Zenith components, hooks, and reactive state.
|
|
13
|
-
- **Emmet Support**: Accelerated HTML development inside `.zen` templates.
|
|
14
|
-
- **Project Scaffolding**: Integrated support for starting new projects.
|
|
15
|
-
- **LSP Integration**: Leverages `@zenithbuild/language-server` for powerful diagnostics and refactoring.
|
|
16
|
-
- **Workspace Commands**:
|
|
17
|
-
- `Zenith: Run Contract Pack`
|
|
18
|
-
- `Zenith: Run Legacy Tests`
|
|
19
|
-
- `Zenith: Build`
|
|
20
|
-
- `Zenith: Restart Server`
|
|
21
|
-
|
|
22
|
-
## Settings
|
|
23
|
-
|
|
24
|
-
- `zenith.componentScripts`: `forbid` (default) or `allow`.
|
|
25
|
-
- `zenith.languageServer.path`: optional absolute or workspace-relative path override for the language server entry file.
|
|
26
|
-
|
|
27
|
-
The extension supports multi-root workspaces. Command execution prompts for the target workspace folder when multiple folders are open.
|
|
28
|
-
|
|
29
|
-
## Supported Extensions
|
|
30
|
-
|
|
31
|
-
- `.zen`
|
|
32
|
-
- `.zenx`
|
|
33
|
-
- `.zen.html`
|
|
34
|
-
|
|
35
|
-
## Recommended Settings
|
|
36
|
-
|
|
37
|
-
The extension automatically configures your editor for the best experience. For more details on customization, see the VS Code settings for Zenith.
|
|
38
|
-
|
|
39
|
-
## Development
|
|
13
|
+
Build the packaged extension bundle:
|
|
40
14
|
|
|
41
15
|
```bash
|
|
42
|
-
|
|
43
|
-
git clone https://github.com/zenithbuild/zenith.git
|
|
44
|
-
|
|
45
|
-
# Navigate to language package
|
|
46
|
-
cd zenith-language
|
|
47
|
-
|
|
48
|
-
# Install dependencies
|
|
49
|
-
bun install
|
|
50
|
-
|
|
51
|
-
# Build the server and compile the extension
|
|
52
|
-
bun run build:all
|
|
16
|
+
bun run build
|
|
53
17
|
```
|
|
54
18
|
|
|
55
|
-
|
|
19
|
+
Package a downloadable VS Code-compatible artifact:
|
|
56
20
|
|
|
57
|
-
|
|
21
|
+
```bash
|
|
22
|
+
bun run package:vsix
|
|
23
|
+
```
|
|
@@ -1,121 +1,53 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
],
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"open": "'",
|
|
57
|
-
"close": "'",
|
|
58
|
-
"notIn": [
|
|
59
|
-
"string",
|
|
60
|
-
"comment"
|
|
61
|
-
]
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"open": "`",
|
|
65
|
-
"close": "`",
|
|
66
|
-
"notIn": [
|
|
67
|
-
"string",
|
|
68
|
-
"comment"
|
|
69
|
-
]
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"open": "<!--",
|
|
73
|
-
"close": "-->",
|
|
74
|
-
"notIn": [
|
|
75
|
-
"comment",
|
|
76
|
-
"string"
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
"surroundingPairs": [
|
|
81
|
-
{
|
|
82
|
-
"open": "{",
|
|
83
|
-
"close": "}"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"open": "[",
|
|
87
|
-
"close": "]"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"open": "(",
|
|
91
|
-
"close": ")"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"open": "<",
|
|
95
|
-
"close": ">"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"open": "\"",
|
|
99
|
-
"close": "\""
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"open": "'",
|
|
103
|
-
"close": "'"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"open": "`",
|
|
107
|
-
"close": "`"
|
|
108
|
-
}
|
|
109
|
-
],
|
|
110
|
-
"folding": {
|
|
111
|
-
"markers": {
|
|
112
|
-
"start": "^\\s*<!--\\s*#region\\b.*-->",
|
|
113
|
-
"end": "^\\s*<!--\\s*#endregion\\b.*-->"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"indentationRules": {
|
|
117
|
-
"increaseIndentPattern": "<(?!\\?|(?:area|base|br|col|frame|hr|html|img|input|keygen|link|menuitem|meta|param|source|track|wbr|script|style)\\b|[^>]*/>)([-_\\.A-Za-z0-9]+)(?=\\s|>)\\b[^>]*>(?!.*</\\1>)|<!--(?!.*-->)|\\{[^}\"']*$",
|
|
118
|
-
"decreaseIndentPattern": "^\\s*(</[-_\\.A-Za-z0-9]+\\b[^>]*>|-?-->|\\})"
|
|
119
|
-
},
|
|
120
|
-
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)"
|
|
121
|
-
}
|
|
2
|
+
"comments": {
|
|
3
|
+
"lineComment": "//",
|
|
4
|
+
"blockComment": ["/*", "*/"]
|
|
5
|
+
},
|
|
6
|
+
"brackets": [
|
|
7
|
+
["{", "}"],
|
|
8
|
+
["[", "]"],
|
|
9
|
+
["(", ")"],
|
|
10
|
+
["<", ">"]
|
|
11
|
+
],
|
|
12
|
+
"autoClosingPairs": [
|
|
13
|
+
{ "open": "{", "close": "}" },
|
|
14
|
+
{ "open": "[", "close": "]" },
|
|
15
|
+
{ "open": "(", "close": ")" },
|
|
16
|
+
{ "open": "\"", "close": "\"" },
|
|
17
|
+
{ "open": "'", "close": "'" },
|
|
18
|
+
{ "open": "`", "close": "`" },
|
|
19
|
+
{ "open": "<!--", "close": "-->", "notIn": ["string"] }
|
|
20
|
+
],
|
|
21
|
+
"surroundingPairs": [
|
|
22
|
+
["{", "}"],
|
|
23
|
+
["[", "]"],
|
|
24
|
+
["(", ")"],
|
|
25
|
+
["\"", "\""],
|
|
26
|
+
["'", "'"],
|
|
27
|
+
["`", "`"],
|
|
28
|
+
["<", ">"]
|
|
29
|
+
],
|
|
30
|
+
"colorizedBracketPairs": [
|
|
31
|
+
["{", "}"],
|
|
32
|
+
["[", "]"],
|
|
33
|
+
["(", ")"]
|
|
34
|
+
],
|
|
35
|
+
"wordPattern": "[A-Za-z_$][\\w$]*(?::[A-Za-z_][\\w-]*)*",
|
|
36
|
+
"indentationRules": {
|
|
37
|
+
"increaseIndentPattern": "<(?!area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr|/|!)[A-Za-z][\\w:-]*[^/>]*>(?!.*</)|\\{[^}]*$|\\([^)]*$",
|
|
38
|
+
"decreaseIndentPattern": "^\\s*(<\\/[A-Za-z][\\w:-]*>|\\}|\\))"
|
|
39
|
+
},
|
|
40
|
+
"onEnterRules": [
|
|
41
|
+
{
|
|
42
|
+
"beforeText": "<(?!area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)([A-Za-z][\\w:-]*)(?:[^/>]*?)>",
|
|
43
|
+
"afterText": "</\\1>",
|
|
44
|
+
"action": { "indent": "indentOutdent", "appendText": "\t" }
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"folding": {
|
|
48
|
+
"markers": {
|
|
49
|
+
"start": "^\\s*<!--\\s*#region\\b",
|
|
50
|
+
"end": "^\\s*<!--\\s*#endregion\\b"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/extension.ts
|
|
31
|
+
var extension_exports = {};
|
|
32
|
+
__export(extension_exports, {
|
|
33
|
+
activate: () => activate,
|
|
34
|
+
deactivate: () => deactivate
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(extension_exports);
|
|
37
|
+
var import_node_path = __toESM(require("node:path"));
|
|
38
|
+
var vscode = __toESM(require("vscode"));
|
|
39
|
+
var import_node = require("vscode-languageclient/node");
|
|
40
|
+
var client;
|
|
41
|
+
function getConfiguredServerPath(context) {
|
|
42
|
+
const configured = vscode.workspace.getConfiguration("zenith").get("languageServer.path", "").trim();
|
|
43
|
+
if (!configured) {
|
|
44
|
+
return context.asAbsolutePath(import_node_path.default.join("out", "server.mjs"));
|
|
45
|
+
}
|
|
46
|
+
if (import_node_path.default.isAbsolute(configured)) {
|
|
47
|
+
return configured;
|
|
48
|
+
}
|
|
49
|
+
const workspaceFolder = vscode.workspace.workspaceFolders?.[0];
|
|
50
|
+
if (workspaceFolder) {
|
|
51
|
+
return import_node_path.default.resolve(workspaceFolder.uri.fsPath, configured);
|
|
52
|
+
}
|
|
53
|
+
return context.asAbsolutePath(configured);
|
|
54
|
+
}
|
|
55
|
+
async function startLanguageClient(context) {
|
|
56
|
+
const serverPath = getConfiguredServerPath(context);
|
|
57
|
+
const serverOptions = {
|
|
58
|
+
run: {
|
|
59
|
+
module: serverPath,
|
|
60
|
+
transport: import_node.TransportKind.stdio
|
|
61
|
+
},
|
|
62
|
+
debug: {
|
|
63
|
+
module: serverPath,
|
|
64
|
+
transport: import_node.TransportKind.stdio,
|
|
65
|
+
options: { execArgv: ["--inspect=6010"] }
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const clientOptions = {
|
|
69
|
+
documentSelector: [{ scheme: "file", language: "zenith" }],
|
|
70
|
+
synchronize: {
|
|
71
|
+
configurationSection: "zenith",
|
|
72
|
+
fileEvents: vscode.workspace.createFileSystemWatcher("**/*.{zen,zen.html,zenx}")
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
client = new import_node.LanguageClient("zenithLanguageServer", "Zenith Language Server", serverOptions, clientOptions);
|
|
76
|
+
await client.start();
|
|
77
|
+
context.subscriptions.push(client);
|
|
78
|
+
}
|
|
79
|
+
async function restartLanguageClient(context) {
|
|
80
|
+
if (client) {
|
|
81
|
+
await client.stop();
|
|
82
|
+
client = void 0;
|
|
83
|
+
}
|
|
84
|
+
await startLanguageClient(context);
|
|
85
|
+
}
|
|
86
|
+
async function activate(context) {
|
|
87
|
+
context.subscriptions.push(
|
|
88
|
+
vscode.commands.registerCommand("zenith.restartServer", async () => {
|
|
89
|
+
await restartLanguageClient(context);
|
|
90
|
+
void vscode.window.showInformationMessage("Zenith language server restarted.");
|
|
91
|
+
})
|
|
92
|
+
);
|
|
93
|
+
context.subscriptions.push(
|
|
94
|
+
vscode.workspace.onDidChangeConfiguration(async (event) => {
|
|
95
|
+
if (!event.affectsConfiguration("zenith.languageServer.path")) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
await restartLanguageClient(context);
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
try {
|
|
102
|
+
await startLanguageClient(context);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
void vscode.window.showErrorMessage(`Zenith: failed to start language server: ${String(error)}`);
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function deactivate() {
|
|
109
|
+
return client?.stop();
|
|
110
|
+
}
|
|
111
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
112
|
+
0 && (module.exports = {
|
|
113
|
+
activate,
|
|
114
|
+
deactivate
|
|
115
|
+
});
|