@zenithbuild/language 0.6.1 → 0.6.17

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 CHANGED
@@ -1,57 +1,9 @@
1
- # zenith-language
1
+ # @zenithbuild/language
2
2
 
3
- VS Code extension providing world-class development support for the Zenith framework.
3
+ Canonical Zenith VS Code language support for `.zen` files.
4
4
 
5
- ## Overview
6
-
7
- `zenith-language` brings the Zenith development experience into VS Code. It provides syntax highlighting, intelligent code completion, and deep integration with the Zenith LSP to make building reactive apps a breeze.
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
40
-
41
- ```bash
42
- # Clone the repository
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
53
- ```
54
-
55
- ## License
56
-
57
- MIT
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`
@@ -1,121 +1,26 @@
1
1
  {
2
- "comments": {
3
- "lineComment": "//",
4
- "blockComment": [
5
- "/*",
6
- "*/"
7
- ]
8
- },
9
- "brackets": [
10
- [
11
- "{",
12
- "}"
13
- ],
14
- [
15
- "[",
16
- "]"
17
- ],
18
- [
19
- "(",
20
- ")"
21
- ],
22
- [
23
- "<",
24
- ">"
25
- ]
26
- ],
27
- "autoClosingPairs": [
28
- {
29
- "open": "{",
30
- "close": "}"
31
- },
32
- {
33
- "open": "[",
34
- "close": "]"
35
- },
36
- {
37
- "open": "(",
38
- "close": ")"
39
- },
40
- {
41
- "open": "<",
42
- "close": ">",
43
- "notIn": [
44
- "string",
45
- "comment"
46
- ]
47
- },
48
- {
49
- "open": "\"",
50
- "close": "\"",
51
- "notIn": [
52
- "string"
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
+ ],
19
+ "surroundingPairs": [
20
+ ["{", "}"],
21
+ ["[", "]"],
22
+ ["(", ")"],
23
+ ["\"", "\""],
24
+ ["'", "'"]
25
+ ]
26
+ }
@@ -0,0 +1,113 @@
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
+ command: process.execPath,
60
+ args: [serverPath],
61
+ options: { env: process.env }
62
+ },
63
+ debug: {
64
+ command: process.execPath,
65
+ args: ["--inspect=6010", serverPath],
66
+ options: { env: process.env }
67
+ }
68
+ };
69
+ const clientOptions = {
70
+ documentSelector: [{ scheme: "file", language: "zenith" }],
71
+ synchronize: {
72
+ configurationSection: "zenith",
73
+ fileEvents: vscode.workspace.createFileSystemWatcher("**/*.{zen,zen.html,zenx}")
74
+ }
75
+ };
76
+ client = new import_node.LanguageClient("zenithLanguageServer", "Zenith Language Server", serverOptions, clientOptions);
77
+ await client.start();
78
+ context.subscriptions.push(client);
79
+ }
80
+ async function restartLanguageClient(context) {
81
+ if (client) {
82
+ await client.stop();
83
+ client = void 0;
84
+ }
85
+ await startLanguageClient(context);
86
+ }
87
+ function activate(context) {
88
+ void startLanguageClient(context).catch((error) => {
89
+ void vscode.window.showErrorMessage(`Zenith: failed to start language server: ${String(error)}`);
90
+ });
91
+ context.subscriptions.push(
92
+ vscode.commands.registerCommand("zenith.restartServer", async () => {
93
+ await restartLanguageClient(context);
94
+ void vscode.window.showInformationMessage("Zenith language server restarted.");
95
+ })
96
+ );
97
+ context.subscriptions.push(
98
+ vscode.workspace.onDidChangeConfiguration(async (event) => {
99
+ if (!event.affectsConfiguration("zenith.languageServer.path")) {
100
+ return;
101
+ }
102
+ await restartLanguageClient(context);
103
+ })
104
+ );
105
+ }
106
+ function deactivate() {
107
+ return client?.stop();
108
+ }
109
+ // Annotate the CommonJS export names for ESM import in node:
110
+ 0 && (module.exports = {
111
+ activate,
112
+ deactivate
113
+ });