@formspec/language-server 0.1.0-alpha.11
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/dist/__tests__/completion.test.d.ts +2 -0
- package/dist/__tests__/completion.test.d.ts.map +1 -0
- package/dist/__tests__/definition.test.d.ts +2 -0
- package/dist/__tests__/definition.test.d.ts.map +1 -0
- package/dist/__tests__/hover.test.d.ts +2 -0
- package/dist/__tests__/hover.test.d.ts.map +1 -0
- package/dist/index.cjs +223 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +1 -0
- package/dist/language-server.d.ts +76 -0
- package/dist/providers/completion.d.ts +22 -0
- package/dist/providers/completion.d.ts.map +1 -0
- package/dist/providers/definition.d.ts +17 -0
- package/dist/providers/definition.d.ts.map +1 -0
- package/dist/providers/hover.d.ts +21 -0
- package/dist/providers/hover.d.ts.map +1 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.d.ts.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/completion.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/definition.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/hover.test.ts"],"names":[],"mappings":""}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
createServer: () => createServer,
|
|
24
|
+
getCompletionItems: () => getCompletionItems,
|
|
25
|
+
getDefinition: () => getDefinition,
|
|
26
|
+
getHoverForTag: () => getHoverForTag
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
|
|
30
|
+
// src/server.ts
|
|
31
|
+
var import_node2 = require("vscode-languageserver/node.js");
|
|
32
|
+
|
|
33
|
+
// src/providers/completion.ts
|
|
34
|
+
var import_node = require("vscode-languageserver/node.js");
|
|
35
|
+
var CONSTRAINT_DETAIL = {
|
|
36
|
+
Minimum: "Minimum numeric value (inclusive). Example: `@Minimum 0`",
|
|
37
|
+
Maximum: "Maximum numeric value (inclusive). Example: `@Maximum 100`",
|
|
38
|
+
ExclusiveMinimum: "Minimum numeric value (exclusive). Example: `@ExclusiveMinimum 0`",
|
|
39
|
+
ExclusiveMaximum: "Maximum numeric value (exclusive). Example: `@ExclusiveMaximum 100`",
|
|
40
|
+
MinLength: "Minimum string length. Example: `@MinLength 1`",
|
|
41
|
+
MaxLength: "Maximum string length. Example: `@MaxLength 255`",
|
|
42
|
+
Pattern: "Regular expression pattern for string validation. Example: `@Pattern ^[a-z]+$`",
|
|
43
|
+
EnumOptions: 'Inline JSON array of allowed enum values. Example: `@EnumOptions ["a","b","c"]`'
|
|
44
|
+
};
|
|
45
|
+
function getCompletionItems() {
|
|
46
|
+
return Object.entries(CONSTRAINT_DETAIL).map(([name, detail]) => ({
|
|
47
|
+
label: `@${name}`,
|
|
48
|
+
kind: import_node.CompletionItemKind.Keyword,
|
|
49
|
+
detail
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/providers/hover.ts
|
|
54
|
+
var import_core = require("@formspec/core");
|
|
55
|
+
var CONSTRAINT_HOVER_DOCS = {
|
|
56
|
+
Minimum: [
|
|
57
|
+
"**@Minimum** `<number>`",
|
|
58
|
+
"",
|
|
59
|
+
"Sets an inclusive lower bound on a numeric field.",
|
|
60
|
+
"",
|
|
61
|
+
"Maps to `minimum` in JSON Schema.",
|
|
62
|
+
"",
|
|
63
|
+
"**Example:**",
|
|
64
|
+
"```typescript",
|
|
65
|
+
"/** @Minimum 0 */",
|
|
66
|
+
"amount: number;",
|
|
67
|
+
"```"
|
|
68
|
+
].join("\n"),
|
|
69
|
+
Maximum: [
|
|
70
|
+
"**@Maximum** `<number>`",
|
|
71
|
+
"",
|
|
72
|
+
"Sets an inclusive upper bound on a numeric field.",
|
|
73
|
+
"",
|
|
74
|
+
"Maps to `maximum` in JSON Schema.",
|
|
75
|
+
"",
|
|
76
|
+
"**Example:**",
|
|
77
|
+
"```typescript",
|
|
78
|
+
"/** @Maximum 100 */",
|
|
79
|
+
"percentage: number;",
|
|
80
|
+
"```"
|
|
81
|
+
].join("\n"),
|
|
82
|
+
ExclusiveMinimum: [
|
|
83
|
+
"**@ExclusiveMinimum** `<number>`",
|
|
84
|
+
"",
|
|
85
|
+
"Sets an exclusive lower bound on a numeric field.",
|
|
86
|
+
"",
|
|
87
|
+
"Maps to `exclusiveMinimum` in JSON Schema.",
|
|
88
|
+
"",
|
|
89
|
+
"**Example:**",
|
|
90
|
+
"```typescript",
|
|
91
|
+
"/** @ExclusiveMinimum 0 */",
|
|
92
|
+
"positiveAmount: number;",
|
|
93
|
+
"```"
|
|
94
|
+
].join("\n"),
|
|
95
|
+
ExclusiveMaximum: [
|
|
96
|
+
"**@ExclusiveMaximum** `<number>`",
|
|
97
|
+
"",
|
|
98
|
+
"Sets an exclusive upper bound on a numeric field.",
|
|
99
|
+
"",
|
|
100
|
+
"Maps to `exclusiveMaximum` in JSON Schema.",
|
|
101
|
+
"",
|
|
102
|
+
"**Example:**",
|
|
103
|
+
"```typescript",
|
|
104
|
+
"/** @ExclusiveMaximum 1 */",
|
|
105
|
+
"ratio: number;",
|
|
106
|
+
"```"
|
|
107
|
+
].join("\n"),
|
|
108
|
+
MinLength: [
|
|
109
|
+
"**@MinLength** `<number>`",
|
|
110
|
+
"",
|
|
111
|
+
"Sets a minimum character length on a string field.",
|
|
112
|
+
"",
|
|
113
|
+
"Maps to `minLength` in JSON Schema.",
|
|
114
|
+
"",
|
|
115
|
+
"**Example:**",
|
|
116
|
+
"```typescript",
|
|
117
|
+
"/** @MinLength 1 */",
|
|
118
|
+
"name: string;",
|
|
119
|
+
"```"
|
|
120
|
+
].join("\n"),
|
|
121
|
+
MaxLength: [
|
|
122
|
+
"**@MaxLength** `<number>`",
|
|
123
|
+
"",
|
|
124
|
+
"Sets a maximum character length on a string field.",
|
|
125
|
+
"",
|
|
126
|
+
"Maps to `maxLength` in JSON Schema.",
|
|
127
|
+
"",
|
|
128
|
+
"**Example:**",
|
|
129
|
+
"```typescript",
|
|
130
|
+
"/** @MaxLength 255 */",
|
|
131
|
+
"description: string;",
|
|
132
|
+
"```"
|
|
133
|
+
].join("\n"),
|
|
134
|
+
Pattern: [
|
|
135
|
+
"**@Pattern** `<regex>`",
|
|
136
|
+
"",
|
|
137
|
+
"Sets a regular expression pattern that a string field must match.",
|
|
138
|
+
"",
|
|
139
|
+
"Maps to `pattern` in JSON Schema.",
|
|
140
|
+
"",
|
|
141
|
+
"**Example:**",
|
|
142
|
+
"```typescript",
|
|
143
|
+
"/** @Pattern ^[a-z0-9]+$ */",
|
|
144
|
+
"slug: string;",
|
|
145
|
+
"```"
|
|
146
|
+
].join("\n"),
|
|
147
|
+
EnumOptions: [
|
|
148
|
+
"**@EnumOptions** `<json-array>`",
|
|
149
|
+
"",
|
|
150
|
+
"Specifies the allowed values for an enum field as an inline JSON array.",
|
|
151
|
+
"",
|
|
152
|
+
"Maps to `enum` in JSON Schema.",
|
|
153
|
+
"",
|
|
154
|
+
"**Example:**",
|
|
155
|
+
"```typescript",
|
|
156
|
+
'/** @EnumOptions ["draft","sent","archived"] */',
|
|
157
|
+
"status: string;",
|
|
158
|
+
"```"
|
|
159
|
+
].join("\n")
|
|
160
|
+
};
|
|
161
|
+
function isBuiltinConstraintName(name) {
|
|
162
|
+
return Object.prototype.hasOwnProperty.call(import_core.BUILTIN_CONSTRAINT_DEFINITIONS, name);
|
|
163
|
+
}
|
|
164
|
+
function getHoverForTag(tagName) {
|
|
165
|
+
const name = tagName.startsWith("@") ? tagName.slice(1) : tagName;
|
|
166
|
+
if (!isBuiltinConstraintName(name)) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
contents: {
|
|
171
|
+
kind: "markdown",
|
|
172
|
+
value: CONSTRAINT_HOVER_DOCS[name]
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// src/providers/definition.ts
|
|
178
|
+
function getDefinition() {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// src/server.ts
|
|
183
|
+
function createServer() {
|
|
184
|
+
const connection = (0, import_node2.createConnection)(import_node2.ProposedFeatures.all);
|
|
185
|
+
connection.onInitialize(() => {
|
|
186
|
+
return {
|
|
187
|
+
capabilities: {
|
|
188
|
+
textDocumentSync: import_node2.TextDocumentSyncKind.Incremental,
|
|
189
|
+
completionProvider: {
|
|
190
|
+
// Trigger completions inside JSDoc comments when `@` is typed
|
|
191
|
+
triggerCharacters: ["@"]
|
|
192
|
+
},
|
|
193
|
+
// Hover and go-to-definition are not yet implemented (token extraction
|
|
194
|
+
// from _params is required). Disabled until those features are wired up
|
|
195
|
+
// so clients don't enable UI affordances that never resolve.
|
|
196
|
+
hoverProvider: false,
|
|
197
|
+
definitionProvider: false
|
|
198
|
+
},
|
|
199
|
+
serverInfo: {
|
|
200
|
+
name: "formspec-language-server",
|
|
201
|
+
version: "0.1.0"
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
});
|
|
205
|
+
connection.onCompletion(() => {
|
|
206
|
+
return getCompletionItems();
|
|
207
|
+
});
|
|
208
|
+
connection.onHover((_params) => {
|
|
209
|
+
return getHoverForTag("");
|
|
210
|
+
});
|
|
211
|
+
connection.onDefinition((_params) => {
|
|
212
|
+
return getDefinition();
|
|
213
|
+
});
|
|
214
|
+
return connection;
|
|
215
|
+
}
|
|
216
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
217
|
+
0 && (module.exports = {
|
|
218
|
+
createServer,
|
|
219
|
+
getCompletionItems,
|
|
220
|
+
getDefinition,
|
|
221
|
+
getHoverForTag
|
|
222
|
+
});
|
|
223
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/server.ts","../src/providers/completion.ts","../src/providers/hover.ts","../src/providers/definition.ts"],"sourcesContent":["/**\n * @formspec/language-server\n *\n * Language server for FormSpec — provides completions, hover documentation,\n * and go-to-definition for FormSpec JSDoc constraint tags (`@Minimum`,\n * `@Maximum`, `@Pattern`, etc.) in TypeScript files.\n *\n * This package implements the Language Server Protocol (LSP) using the\n * `vscode-languageserver` library. Constraint names are sourced from\n * `BUILTIN_CONSTRAINT_DEFINITIONS` in `@formspec/core`, ensuring the\n * language server stays in sync with the single source of truth.\n *\n * Diagnostics are intentionally omitted per design decision A7.\n *\n * @example\n * ```ts\n * import { createServer } from '@formspec/language-server';\n *\n * const connection = createServer();\n * connection.listen();\n * ```\n *\n * @packageDocumentation\n */\n\nexport { createServer } from \"./server.js\";\nexport { getCompletionItems } from \"./providers/completion.js\";\nexport { getHoverForTag } from \"./providers/hover.js\";\nexport { getDefinition } from \"./providers/definition.js\";\n","/**\n * FormSpec Language Server\n *\n * Sets up an LSP server connection and registers handlers for:\n * - `textDocument/completion` — FormSpec JSDoc constraint tag completions\n * - `textDocument/hover` — Documentation for recognized constraint tags\n * - `textDocument/definition` — Go-to-definition (stub, returns null)\n *\n * Diagnostics are intentionally omitted per design decision A7.\n */\n\nimport {\n createConnection,\n ProposedFeatures,\n TextDocumentSyncKind,\n type Connection,\n type InitializeResult,\n} from \"vscode-languageserver/node.js\";\nimport { getCompletionItems } from \"./providers/completion.js\";\nimport { getHoverForTag } from \"./providers/hover.js\";\nimport { getDefinition } from \"./providers/definition.js\";\n\n/**\n * Creates and configures the FormSpec language server connection.\n *\n * Registers LSP capability handlers and returns the connection.\n * Call `connection.listen()` to start accepting messages.\n *\n * @returns The configured LSP connection (not yet listening)\n */\nexport function createServer(): Connection {\n const connection = createConnection(ProposedFeatures.all);\n\n connection.onInitialize((): InitializeResult => {\n return {\n capabilities: {\n textDocumentSync: TextDocumentSyncKind.Incremental,\n completionProvider: {\n // Trigger completions inside JSDoc comments when `@` is typed\n triggerCharacters: [\"@\"],\n },\n // Hover and go-to-definition are not yet implemented (token extraction\n // from _params is required). Disabled until those features are wired up\n // so clients don't enable UI affordances that never resolve.\n hoverProvider: false,\n definitionProvider: false,\n },\n serverInfo: {\n name: \"formspec-language-server\",\n version: \"0.1.0\",\n },\n };\n });\n\n connection.onCompletion(() => {\n // Return all FormSpec constraint tag completions.\n // Future phases will add context-aware filtering based on field type and\n // cursor position within JSDoc comment ranges.\n return getCompletionItems();\n });\n\n connection.onHover((_params) => {\n // Extract the word under the cursor and look up hover documentation.\n // This is a stub — precise JSDoc token detection (checking that the\n // cursor is within a JSDoc comment and extracting the tag name) will be\n // added in a future phase.\n //\n // For now we return null to signal no hover is available until the\n // token extraction is implemented.\n return getHoverForTag(\"\");\n });\n\n connection.onDefinition((_params) => {\n // Go-to-definition is not yet implemented.\n return getDefinition();\n });\n\n return connection;\n}\n","/**\n * Completion provider for FormSpec JSDoc constraint tags.\n *\n * Returns completion items for all recognized FormSpec JSDoc constraint tags\n * (e.g., `@Minimum`, `@Maximum`, `@Pattern`), derived from\n * `BUILTIN_CONSTRAINT_DEFINITIONS`. This is a skeleton — context-aware\n * filtering will be added in a future phase.\n */\n\nimport type { CompletionItem } from \"vscode-languageserver/node.js\";\nimport { CompletionItemKind } from \"vscode-languageserver/node.js\";\n\n/**\n * Human-readable detail strings for each built-in constraint tag.\n *\n * Keys match the constraint name (matching keys in `BUILTIN_CONSTRAINT_DEFINITIONS`).\n * Values are shown as the detail string in completion items.\n */\nconst CONSTRAINT_DETAIL: Record<string, string> = {\n Minimum: \"Minimum numeric value (inclusive). Example: `@Minimum 0`\",\n Maximum: \"Maximum numeric value (inclusive). Example: `@Maximum 100`\",\n ExclusiveMinimum: \"Minimum numeric value (exclusive). Example: `@ExclusiveMinimum 0`\",\n ExclusiveMaximum: \"Maximum numeric value (exclusive). Example: `@ExclusiveMaximum 100`\",\n MinLength: \"Minimum string length. Example: `@MinLength 1`\",\n MaxLength: \"Maximum string length. Example: `@MaxLength 255`\",\n Pattern: \"Regular expression pattern for string validation. Example: `@Pattern ^[a-z]+$`\",\n EnumOptions: 'Inline JSON array of allowed enum values. Example: `@EnumOptions [\"a\",\"b\",\"c\"]`',\n};\n\n/**\n * Returns completion items for all FormSpec JSDoc constraint tags.\n *\n * Items are derived from `BUILTIN_CONSTRAINT_DEFINITIONS`, ensuring this list\n * stays in sync with the single source of truth in `@formspec/core`.\n *\n * Each item uses `CompletionItemKind.Keyword` since these are annotation\n * tags used within JSDoc comments rather than language symbols.\n *\n * @returns An array of LSP completion items for FormSpec constraint tags\n */\nexport function getCompletionItems(): CompletionItem[] {\n return Object.entries(CONSTRAINT_DETAIL).map(([name, detail]) => ({\n\n label: `@${name}`,\n kind: CompletionItemKind.Keyword,\n detail,\n }));\n}\n","/**\n * Hover provider for FormSpec JSDoc constraint tags.\n *\n * Returns Markdown documentation for a recognized FormSpec JSDoc tag when\n * the cursor is positioned over it. This is a skeleton — precise token\n * detection within JSDoc comment ranges will be added in a future phase.\n */\n\nimport { BUILTIN_CONSTRAINT_DEFINITIONS, type BuiltinConstraintName } from \"@formspec/core\";\nimport type { Hover } from \"vscode-languageserver/node.js\";\n\n/**\n * Markdown documentation for each built-in FormSpec constraint tag.\n *\n * Keys are the canonical constraint names from `BUILTIN_CONSTRAINT_DEFINITIONS`.\n * Values are Markdown strings suitable for LSP hover responses.\n */\nconst CONSTRAINT_HOVER_DOCS: Record<BuiltinConstraintName, string> = {\n Minimum: [\n \"**@Minimum** `<number>`\",\n \"\",\n \"Sets an inclusive lower bound on a numeric field.\",\n \"\",\n \"Maps to `minimum` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @Minimum 0 */\",\n \"amount: number;\",\n \"```\",\n ].join(\"\\n\"),\n\n Maximum: [\n \"**@Maximum** `<number>`\",\n \"\",\n \"Sets an inclusive upper bound on a numeric field.\",\n \"\",\n \"Maps to `maximum` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @Maximum 100 */\",\n \"percentage: number;\",\n \"```\",\n ].join(\"\\n\"),\n\n ExclusiveMinimum: [\n \"**@ExclusiveMinimum** `<number>`\",\n \"\",\n \"Sets an exclusive lower bound on a numeric field.\",\n \"\",\n \"Maps to `exclusiveMinimum` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @ExclusiveMinimum 0 */\",\n \"positiveAmount: number;\",\n \"```\",\n ].join(\"\\n\"),\n\n ExclusiveMaximum: [\n \"**@ExclusiveMaximum** `<number>`\",\n \"\",\n \"Sets an exclusive upper bound on a numeric field.\",\n \"\",\n \"Maps to `exclusiveMaximum` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @ExclusiveMaximum 1 */\",\n \"ratio: number;\",\n \"```\",\n ].join(\"\\n\"),\n\n MinLength: [\n \"**@MinLength** `<number>`\",\n \"\",\n \"Sets a minimum character length on a string field.\",\n \"\",\n \"Maps to `minLength` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @MinLength 1 */\",\n \"name: string;\",\n \"```\",\n ].join(\"\\n\"),\n\n MaxLength: [\n \"**@MaxLength** `<number>`\",\n \"\",\n \"Sets a maximum character length on a string field.\",\n \"\",\n \"Maps to `maxLength` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @MaxLength 255 */\",\n \"description: string;\",\n \"```\",\n ].join(\"\\n\"),\n\n Pattern: [\n \"**@Pattern** `<regex>`\",\n \"\",\n \"Sets a regular expression pattern that a string field must match.\",\n \"\",\n \"Maps to `pattern` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @Pattern ^[a-z0-9]+$ */\",\n \"slug: string;\",\n \"```\",\n ].join(\"\\n\"),\n\n EnumOptions: [\n \"**@EnumOptions** `<json-array>`\",\n \"\",\n \"Specifies the allowed values for an enum field as an inline JSON array.\",\n \"\",\n \"Maps to `enum` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n '/** @EnumOptions [\"draft\",\"sent\",\"archived\"] */',\n \"status: string;\",\n \"```\",\n ].join(\"\\n\"),\n} satisfies Record<BuiltinConstraintName, string>;\n\n/**\n * Checks whether a given string is a recognized built-in constraint name.\n *\n * @param name - The name to check\n * @returns `true` if `name` is a `BuiltinConstraintName`\n */\nfunction isBuiltinConstraintName(name: string): name is BuiltinConstraintName {\n return Object.prototype.hasOwnProperty.call(BUILTIN_CONSTRAINT_DEFINITIONS, name);\n}\n\n/**\n * Returns hover documentation for a FormSpec JSDoc tag name.\n *\n * The tag name lookup is case-sensitive and matches the canonical casing used\n * in `BUILTIN_CONSTRAINT_DEFINITIONS` (e.g., `\"Minimum\"`, `\"Pattern\"`).\n * The `@` prefix is stripped before lookup if present.\n * Returns `null` when the tag is not a recognized FormSpec constraint tag.\n *\n * @param tagName - The tag name to look up (e.g., `\"Minimum\"`, `\"@Pattern\"`)\n * @returns An LSP `Hover` response, or `null` if the tag is not recognized\n */\nexport function getHoverForTag(tagName: string): Hover | null {\n // Strip leading `@` prefix if present\n const name = tagName.startsWith(\"@\") ? tagName.slice(1) : tagName;\n\n if (!isBuiltinConstraintName(name)) {\n return null;\n }\n\n return {\n contents: {\n kind: \"markdown\",\n value: CONSTRAINT_HOVER_DOCS[name],\n },\n };\n}\n","/**\n * Go-to-definition provider for FormSpec.\n *\n * This is a stub — go-to-definition support (e.g., navigating from a\n * `field.text(\"name\")` call to the form definition that references it) will\n * be implemented in a future phase.\n */\n\nimport type { Location } from \"vscode-languageserver/node.js\";\n\n/**\n * Returns the definition location for a symbol at the given position.\n *\n * Always returns `null` in this stub implementation.\n *\n * @returns `null` — not yet implemented\n */\nexport function getDefinition(): Location | null {\n return null;\n}\n"],"mappings":"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","names":["import_node"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @formspec/language-server
|
|
3
|
+
*
|
|
4
|
+
* Language server for FormSpec — provides completions, hover documentation,
|
|
5
|
+
* and go-to-definition for FormSpec JSDoc constraint tags (`@Minimum`,
|
|
6
|
+
* `@Maximum`, `@Pattern`, etc.) in TypeScript files.
|
|
7
|
+
*
|
|
8
|
+
* This package implements the Language Server Protocol (LSP) using the
|
|
9
|
+
* `vscode-languageserver` library. Constraint names are sourced from
|
|
10
|
+
* `BUILTIN_CONSTRAINT_DEFINITIONS` in `@formspec/core`, ensuring the
|
|
11
|
+
* language server stays in sync with the single source of truth.
|
|
12
|
+
*
|
|
13
|
+
* Diagnostics are intentionally omitted per design decision A7.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { createServer } from '@formspec/language-server';
|
|
18
|
+
*
|
|
19
|
+
* const connection = createServer();
|
|
20
|
+
* connection.listen();
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
*/
|
|
25
|
+
export { createServer } from "./server.js";
|
|
26
|
+
export { getCompletionItems } from "./providers/completion.js";
|
|
27
|
+
export { getHoverForTag } from "./providers/hover.js";
|
|
28
|
+
export { getDefinition } from "./providers/definition.js";
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// src/server.ts
|
|
2
|
+
import {
|
|
3
|
+
createConnection,
|
|
4
|
+
ProposedFeatures,
|
|
5
|
+
TextDocumentSyncKind
|
|
6
|
+
} from "vscode-languageserver/node.js";
|
|
7
|
+
|
|
8
|
+
// src/providers/completion.ts
|
|
9
|
+
import { CompletionItemKind } from "vscode-languageserver/node.js";
|
|
10
|
+
var CONSTRAINT_DETAIL = {
|
|
11
|
+
Minimum: "Minimum numeric value (inclusive). Example: `@Minimum 0`",
|
|
12
|
+
Maximum: "Maximum numeric value (inclusive). Example: `@Maximum 100`",
|
|
13
|
+
ExclusiveMinimum: "Minimum numeric value (exclusive). Example: `@ExclusiveMinimum 0`",
|
|
14
|
+
ExclusiveMaximum: "Maximum numeric value (exclusive). Example: `@ExclusiveMaximum 100`",
|
|
15
|
+
MinLength: "Minimum string length. Example: `@MinLength 1`",
|
|
16
|
+
MaxLength: "Maximum string length. Example: `@MaxLength 255`",
|
|
17
|
+
Pattern: "Regular expression pattern for string validation. Example: `@Pattern ^[a-z]+$`",
|
|
18
|
+
EnumOptions: 'Inline JSON array of allowed enum values. Example: `@EnumOptions ["a","b","c"]`'
|
|
19
|
+
};
|
|
20
|
+
function getCompletionItems() {
|
|
21
|
+
return Object.entries(CONSTRAINT_DETAIL).map(([name, detail]) => ({
|
|
22
|
+
label: `@${name}`,
|
|
23
|
+
kind: CompletionItemKind.Keyword,
|
|
24
|
+
detail
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/providers/hover.ts
|
|
29
|
+
import { BUILTIN_CONSTRAINT_DEFINITIONS } from "@formspec/core";
|
|
30
|
+
var CONSTRAINT_HOVER_DOCS = {
|
|
31
|
+
Minimum: [
|
|
32
|
+
"**@Minimum** `<number>`",
|
|
33
|
+
"",
|
|
34
|
+
"Sets an inclusive lower bound on a numeric field.",
|
|
35
|
+
"",
|
|
36
|
+
"Maps to `minimum` in JSON Schema.",
|
|
37
|
+
"",
|
|
38
|
+
"**Example:**",
|
|
39
|
+
"```typescript",
|
|
40
|
+
"/** @Minimum 0 */",
|
|
41
|
+
"amount: number;",
|
|
42
|
+
"```"
|
|
43
|
+
].join("\n"),
|
|
44
|
+
Maximum: [
|
|
45
|
+
"**@Maximum** `<number>`",
|
|
46
|
+
"",
|
|
47
|
+
"Sets an inclusive upper bound on a numeric field.",
|
|
48
|
+
"",
|
|
49
|
+
"Maps to `maximum` in JSON Schema.",
|
|
50
|
+
"",
|
|
51
|
+
"**Example:**",
|
|
52
|
+
"```typescript",
|
|
53
|
+
"/** @Maximum 100 */",
|
|
54
|
+
"percentage: number;",
|
|
55
|
+
"```"
|
|
56
|
+
].join("\n"),
|
|
57
|
+
ExclusiveMinimum: [
|
|
58
|
+
"**@ExclusiveMinimum** `<number>`",
|
|
59
|
+
"",
|
|
60
|
+
"Sets an exclusive lower bound on a numeric field.",
|
|
61
|
+
"",
|
|
62
|
+
"Maps to `exclusiveMinimum` in JSON Schema.",
|
|
63
|
+
"",
|
|
64
|
+
"**Example:**",
|
|
65
|
+
"```typescript",
|
|
66
|
+
"/** @ExclusiveMinimum 0 */",
|
|
67
|
+
"positiveAmount: number;",
|
|
68
|
+
"```"
|
|
69
|
+
].join("\n"),
|
|
70
|
+
ExclusiveMaximum: [
|
|
71
|
+
"**@ExclusiveMaximum** `<number>`",
|
|
72
|
+
"",
|
|
73
|
+
"Sets an exclusive upper bound on a numeric field.",
|
|
74
|
+
"",
|
|
75
|
+
"Maps to `exclusiveMaximum` in JSON Schema.",
|
|
76
|
+
"",
|
|
77
|
+
"**Example:**",
|
|
78
|
+
"```typescript",
|
|
79
|
+
"/** @ExclusiveMaximum 1 */",
|
|
80
|
+
"ratio: number;",
|
|
81
|
+
"```"
|
|
82
|
+
].join("\n"),
|
|
83
|
+
MinLength: [
|
|
84
|
+
"**@MinLength** `<number>`",
|
|
85
|
+
"",
|
|
86
|
+
"Sets a minimum character length on a string field.",
|
|
87
|
+
"",
|
|
88
|
+
"Maps to `minLength` in JSON Schema.",
|
|
89
|
+
"",
|
|
90
|
+
"**Example:**",
|
|
91
|
+
"```typescript",
|
|
92
|
+
"/** @MinLength 1 */",
|
|
93
|
+
"name: string;",
|
|
94
|
+
"```"
|
|
95
|
+
].join("\n"),
|
|
96
|
+
MaxLength: [
|
|
97
|
+
"**@MaxLength** `<number>`",
|
|
98
|
+
"",
|
|
99
|
+
"Sets a maximum character length on a string field.",
|
|
100
|
+
"",
|
|
101
|
+
"Maps to `maxLength` in JSON Schema.",
|
|
102
|
+
"",
|
|
103
|
+
"**Example:**",
|
|
104
|
+
"```typescript",
|
|
105
|
+
"/** @MaxLength 255 */",
|
|
106
|
+
"description: string;",
|
|
107
|
+
"```"
|
|
108
|
+
].join("\n"),
|
|
109
|
+
Pattern: [
|
|
110
|
+
"**@Pattern** `<regex>`",
|
|
111
|
+
"",
|
|
112
|
+
"Sets a regular expression pattern that a string field must match.",
|
|
113
|
+
"",
|
|
114
|
+
"Maps to `pattern` in JSON Schema.",
|
|
115
|
+
"",
|
|
116
|
+
"**Example:**",
|
|
117
|
+
"```typescript",
|
|
118
|
+
"/** @Pattern ^[a-z0-9]+$ */",
|
|
119
|
+
"slug: string;",
|
|
120
|
+
"```"
|
|
121
|
+
].join("\n"),
|
|
122
|
+
EnumOptions: [
|
|
123
|
+
"**@EnumOptions** `<json-array>`",
|
|
124
|
+
"",
|
|
125
|
+
"Specifies the allowed values for an enum field as an inline JSON array.",
|
|
126
|
+
"",
|
|
127
|
+
"Maps to `enum` in JSON Schema.",
|
|
128
|
+
"",
|
|
129
|
+
"**Example:**",
|
|
130
|
+
"```typescript",
|
|
131
|
+
'/** @EnumOptions ["draft","sent","archived"] */',
|
|
132
|
+
"status: string;",
|
|
133
|
+
"```"
|
|
134
|
+
].join("\n")
|
|
135
|
+
};
|
|
136
|
+
function isBuiltinConstraintName(name) {
|
|
137
|
+
return Object.prototype.hasOwnProperty.call(BUILTIN_CONSTRAINT_DEFINITIONS, name);
|
|
138
|
+
}
|
|
139
|
+
function getHoverForTag(tagName) {
|
|
140
|
+
const name = tagName.startsWith("@") ? tagName.slice(1) : tagName;
|
|
141
|
+
if (!isBuiltinConstraintName(name)) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
contents: {
|
|
146
|
+
kind: "markdown",
|
|
147
|
+
value: CONSTRAINT_HOVER_DOCS[name]
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// src/providers/definition.ts
|
|
153
|
+
function getDefinition() {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// src/server.ts
|
|
158
|
+
function createServer() {
|
|
159
|
+
const connection = createConnection(ProposedFeatures.all);
|
|
160
|
+
connection.onInitialize(() => {
|
|
161
|
+
return {
|
|
162
|
+
capabilities: {
|
|
163
|
+
textDocumentSync: TextDocumentSyncKind.Incremental,
|
|
164
|
+
completionProvider: {
|
|
165
|
+
// Trigger completions inside JSDoc comments when `@` is typed
|
|
166
|
+
triggerCharacters: ["@"]
|
|
167
|
+
},
|
|
168
|
+
// Hover and go-to-definition are not yet implemented (token extraction
|
|
169
|
+
// from _params is required). Disabled until those features are wired up
|
|
170
|
+
// so clients don't enable UI affordances that never resolve.
|
|
171
|
+
hoverProvider: false,
|
|
172
|
+
definitionProvider: false
|
|
173
|
+
},
|
|
174
|
+
serverInfo: {
|
|
175
|
+
name: "formspec-language-server",
|
|
176
|
+
version: "0.1.0"
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
connection.onCompletion(() => {
|
|
181
|
+
return getCompletionItems();
|
|
182
|
+
});
|
|
183
|
+
connection.onHover((_params) => {
|
|
184
|
+
return getHoverForTag("");
|
|
185
|
+
});
|
|
186
|
+
connection.onDefinition((_params) => {
|
|
187
|
+
return getDefinition();
|
|
188
|
+
});
|
|
189
|
+
return connection;
|
|
190
|
+
}
|
|
191
|
+
export {
|
|
192
|
+
createServer,
|
|
193
|
+
getCompletionItems,
|
|
194
|
+
getDefinition,
|
|
195
|
+
getHoverForTag
|
|
196
|
+
};
|
|
197
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server.ts","../src/providers/completion.ts","../src/providers/hover.ts","../src/providers/definition.ts"],"sourcesContent":["/**\n * FormSpec Language Server\n *\n * Sets up an LSP server connection and registers handlers for:\n * - `textDocument/completion` — FormSpec JSDoc constraint tag completions\n * - `textDocument/hover` — Documentation for recognized constraint tags\n * - `textDocument/definition` — Go-to-definition (stub, returns null)\n *\n * Diagnostics are intentionally omitted per design decision A7.\n */\n\nimport {\n createConnection,\n ProposedFeatures,\n TextDocumentSyncKind,\n type Connection,\n type InitializeResult,\n} from \"vscode-languageserver/node.js\";\nimport { getCompletionItems } from \"./providers/completion.js\";\nimport { getHoverForTag } from \"./providers/hover.js\";\nimport { getDefinition } from \"./providers/definition.js\";\n\n/**\n * Creates and configures the FormSpec language server connection.\n *\n * Registers LSP capability handlers and returns the connection.\n * Call `connection.listen()` to start accepting messages.\n *\n * @returns The configured LSP connection (not yet listening)\n */\nexport function createServer(): Connection {\n const connection = createConnection(ProposedFeatures.all);\n\n connection.onInitialize((): InitializeResult => {\n return {\n capabilities: {\n textDocumentSync: TextDocumentSyncKind.Incremental,\n completionProvider: {\n // Trigger completions inside JSDoc comments when `@` is typed\n triggerCharacters: [\"@\"],\n },\n // Hover and go-to-definition are not yet implemented (token extraction\n // from _params is required). Disabled until those features are wired up\n // so clients don't enable UI affordances that never resolve.\n hoverProvider: false,\n definitionProvider: false,\n },\n serverInfo: {\n name: \"formspec-language-server\",\n version: \"0.1.0\",\n },\n };\n });\n\n connection.onCompletion(() => {\n // Return all FormSpec constraint tag completions.\n // Future phases will add context-aware filtering based on field type and\n // cursor position within JSDoc comment ranges.\n return getCompletionItems();\n });\n\n connection.onHover((_params) => {\n // Extract the word under the cursor and look up hover documentation.\n // This is a stub — precise JSDoc token detection (checking that the\n // cursor is within a JSDoc comment and extracting the tag name) will be\n // added in a future phase.\n //\n // For now we return null to signal no hover is available until the\n // token extraction is implemented.\n return getHoverForTag(\"\");\n });\n\n connection.onDefinition((_params) => {\n // Go-to-definition is not yet implemented.\n return getDefinition();\n });\n\n return connection;\n}\n","/**\n * Completion provider for FormSpec JSDoc constraint tags.\n *\n * Returns completion items for all recognized FormSpec JSDoc constraint tags\n * (e.g., `@Minimum`, `@Maximum`, `@Pattern`), derived from\n * `BUILTIN_CONSTRAINT_DEFINITIONS`. This is a skeleton — context-aware\n * filtering will be added in a future phase.\n */\n\nimport type { CompletionItem } from \"vscode-languageserver/node.js\";\nimport { CompletionItemKind } from \"vscode-languageserver/node.js\";\n\n/**\n * Human-readable detail strings for each built-in constraint tag.\n *\n * Keys match the constraint name (matching keys in `BUILTIN_CONSTRAINT_DEFINITIONS`).\n * Values are shown as the detail string in completion items.\n */\nconst CONSTRAINT_DETAIL: Record<string, string> = {\n Minimum: \"Minimum numeric value (inclusive). Example: `@Minimum 0`\",\n Maximum: \"Maximum numeric value (inclusive). Example: `@Maximum 100`\",\n ExclusiveMinimum: \"Minimum numeric value (exclusive). Example: `@ExclusiveMinimum 0`\",\n ExclusiveMaximum: \"Maximum numeric value (exclusive). Example: `@ExclusiveMaximum 100`\",\n MinLength: \"Minimum string length. Example: `@MinLength 1`\",\n MaxLength: \"Maximum string length. Example: `@MaxLength 255`\",\n Pattern: \"Regular expression pattern for string validation. Example: `@Pattern ^[a-z]+$`\",\n EnumOptions: 'Inline JSON array of allowed enum values. Example: `@EnumOptions [\"a\",\"b\",\"c\"]`',\n};\n\n/**\n * Returns completion items for all FormSpec JSDoc constraint tags.\n *\n * Items are derived from `BUILTIN_CONSTRAINT_DEFINITIONS`, ensuring this list\n * stays in sync with the single source of truth in `@formspec/core`.\n *\n * Each item uses `CompletionItemKind.Keyword` since these are annotation\n * tags used within JSDoc comments rather than language symbols.\n *\n * @returns An array of LSP completion items for FormSpec constraint tags\n */\nexport function getCompletionItems(): CompletionItem[] {\n return Object.entries(CONSTRAINT_DETAIL).map(([name, detail]) => ({\n\n label: `@${name}`,\n kind: CompletionItemKind.Keyword,\n detail,\n }));\n}\n","/**\n * Hover provider for FormSpec JSDoc constraint tags.\n *\n * Returns Markdown documentation for a recognized FormSpec JSDoc tag when\n * the cursor is positioned over it. This is a skeleton — precise token\n * detection within JSDoc comment ranges will be added in a future phase.\n */\n\nimport { BUILTIN_CONSTRAINT_DEFINITIONS, type BuiltinConstraintName } from \"@formspec/core\";\nimport type { Hover } from \"vscode-languageserver/node.js\";\n\n/**\n * Markdown documentation for each built-in FormSpec constraint tag.\n *\n * Keys are the canonical constraint names from `BUILTIN_CONSTRAINT_DEFINITIONS`.\n * Values are Markdown strings suitable for LSP hover responses.\n */\nconst CONSTRAINT_HOVER_DOCS: Record<BuiltinConstraintName, string> = {\n Minimum: [\n \"**@Minimum** `<number>`\",\n \"\",\n \"Sets an inclusive lower bound on a numeric field.\",\n \"\",\n \"Maps to `minimum` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @Minimum 0 */\",\n \"amount: number;\",\n \"```\",\n ].join(\"\\n\"),\n\n Maximum: [\n \"**@Maximum** `<number>`\",\n \"\",\n \"Sets an inclusive upper bound on a numeric field.\",\n \"\",\n \"Maps to `maximum` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @Maximum 100 */\",\n \"percentage: number;\",\n \"```\",\n ].join(\"\\n\"),\n\n ExclusiveMinimum: [\n \"**@ExclusiveMinimum** `<number>`\",\n \"\",\n \"Sets an exclusive lower bound on a numeric field.\",\n \"\",\n \"Maps to `exclusiveMinimum` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @ExclusiveMinimum 0 */\",\n \"positiveAmount: number;\",\n \"```\",\n ].join(\"\\n\"),\n\n ExclusiveMaximum: [\n \"**@ExclusiveMaximum** `<number>`\",\n \"\",\n \"Sets an exclusive upper bound on a numeric field.\",\n \"\",\n \"Maps to `exclusiveMaximum` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @ExclusiveMaximum 1 */\",\n \"ratio: number;\",\n \"```\",\n ].join(\"\\n\"),\n\n MinLength: [\n \"**@MinLength** `<number>`\",\n \"\",\n \"Sets a minimum character length on a string field.\",\n \"\",\n \"Maps to `minLength` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @MinLength 1 */\",\n \"name: string;\",\n \"```\",\n ].join(\"\\n\"),\n\n MaxLength: [\n \"**@MaxLength** `<number>`\",\n \"\",\n \"Sets a maximum character length on a string field.\",\n \"\",\n \"Maps to `maxLength` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @MaxLength 255 */\",\n \"description: string;\",\n \"```\",\n ].join(\"\\n\"),\n\n Pattern: [\n \"**@Pattern** `<regex>`\",\n \"\",\n \"Sets a regular expression pattern that a string field must match.\",\n \"\",\n \"Maps to `pattern` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @Pattern ^[a-z0-9]+$ */\",\n \"slug: string;\",\n \"```\",\n ].join(\"\\n\"),\n\n EnumOptions: [\n \"**@EnumOptions** `<json-array>`\",\n \"\",\n \"Specifies the allowed values for an enum field as an inline JSON array.\",\n \"\",\n \"Maps to `enum` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n '/** @EnumOptions [\"draft\",\"sent\",\"archived\"] */',\n \"status: string;\",\n \"```\",\n ].join(\"\\n\"),\n} satisfies Record<BuiltinConstraintName, string>;\n\n/**\n * Checks whether a given string is a recognized built-in constraint name.\n *\n * @param name - The name to check\n * @returns `true` if `name` is a `BuiltinConstraintName`\n */\nfunction isBuiltinConstraintName(name: string): name is BuiltinConstraintName {\n return Object.prototype.hasOwnProperty.call(BUILTIN_CONSTRAINT_DEFINITIONS, name);\n}\n\n/**\n * Returns hover documentation for a FormSpec JSDoc tag name.\n *\n * The tag name lookup is case-sensitive and matches the canonical casing used\n * in `BUILTIN_CONSTRAINT_DEFINITIONS` (e.g., `\"Minimum\"`, `\"Pattern\"`).\n * The `@` prefix is stripped before lookup if present.\n * Returns `null` when the tag is not a recognized FormSpec constraint tag.\n *\n * @param tagName - The tag name to look up (e.g., `\"Minimum\"`, `\"@Pattern\"`)\n * @returns An LSP `Hover` response, or `null` if the tag is not recognized\n */\nexport function getHoverForTag(tagName: string): Hover | null {\n // Strip leading `@` prefix if present\n const name = tagName.startsWith(\"@\") ? tagName.slice(1) : tagName;\n\n if (!isBuiltinConstraintName(name)) {\n return null;\n }\n\n return {\n contents: {\n kind: \"markdown\",\n value: CONSTRAINT_HOVER_DOCS[name],\n },\n };\n}\n","/**\n * Go-to-definition provider for FormSpec.\n *\n * This is a stub — go-to-definition support (e.g., navigating from a\n * `field.text(\"name\")` call to the form definition that references it) will\n * be implemented in a future phase.\n */\n\nimport type { Location } from \"vscode-languageserver/node.js\";\n\n/**\n * Returns the definition location for a symbol at the given position.\n *\n * Always returns `null` in this stub implementation.\n *\n * @returns `null` — not yet implemented\n */\nexport function getDefinition(): Location | null {\n return null;\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @formspec/language-server
|
|
3
|
+
*
|
|
4
|
+
* Language server for FormSpec — provides completions, hover documentation,
|
|
5
|
+
* and go-to-definition for FormSpec JSDoc constraint tags (`@Minimum`,
|
|
6
|
+
* `@Maximum`, `@Pattern`, etc.) in TypeScript files.
|
|
7
|
+
*
|
|
8
|
+
* This package implements the Language Server Protocol (LSP) using the
|
|
9
|
+
* `vscode-languageserver` library. Constraint names are sourced from
|
|
10
|
+
* `BUILTIN_CONSTRAINT_DEFINITIONS` in `@formspec/core`, ensuring the
|
|
11
|
+
* language server stays in sync with the single source of truth.
|
|
12
|
+
*
|
|
13
|
+
* Diagnostics are intentionally omitted per design decision A7.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { createServer } from '@formspec/language-server';
|
|
18
|
+
*
|
|
19
|
+
* const connection = createServer();
|
|
20
|
+
* connection.listen();
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import type { CompletionItem } from 'vscode-languageserver/node.js';
|
|
27
|
+
import { Connection } from 'vscode-languageserver/node.js';
|
|
28
|
+
import type { Hover } from 'vscode-languageserver/node.js';
|
|
29
|
+
import type { Location } from 'vscode-languageserver/node.js';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates and configures the FormSpec language server connection.
|
|
33
|
+
*
|
|
34
|
+
* Registers LSP capability handlers and returns the connection.
|
|
35
|
+
* Call `connection.listen()` to start accepting messages.
|
|
36
|
+
*
|
|
37
|
+
* @returns The configured LSP connection (not yet listening)
|
|
38
|
+
*/
|
|
39
|
+
export declare function createServer(): Connection;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns completion items for all FormSpec JSDoc constraint tags.
|
|
43
|
+
*
|
|
44
|
+
* Items are derived from `BUILTIN_CONSTRAINT_DEFINITIONS`, ensuring this list
|
|
45
|
+
* stays in sync with the single source of truth in `@formspec/core`.
|
|
46
|
+
*
|
|
47
|
+
* Each item uses `CompletionItemKind.Keyword` since these are annotation
|
|
48
|
+
* tags used within JSDoc comments rather than language symbols.
|
|
49
|
+
*
|
|
50
|
+
* @returns An array of LSP completion items for FormSpec constraint tags
|
|
51
|
+
*/
|
|
52
|
+
export declare function getCompletionItems(): CompletionItem[];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Returns the definition location for a symbol at the given position.
|
|
56
|
+
*
|
|
57
|
+
* Always returns `null` in this stub implementation.
|
|
58
|
+
*
|
|
59
|
+
* @returns `null` — not yet implemented
|
|
60
|
+
*/
|
|
61
|
+
export declare function getDefinition(): Location | null;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Returns hover documentation for a FormSpec JSDoc tag name.
|
|
65
|
+
*
|
|
66
|
+
* The tag name lookup is case-sensitive and matches the canonical casing used
|
|
67
|
+
* in `BUILTIN_CONSTRAINT_DEFINITIONS` (e.g., `"Minimum"`, `"Pattern"`).
|
|
68
|
+
* The `@` prefix is stripped before lookup if present.
|
|
69
|
+
* Returns `null` when the tag is not a recognized FormSpec constraint tag.
|
|
70
|
+
*
|
|
71
|
+
* @param tagName - The tag name to look up (e.g., `"Minimum"`, `"@Pattern"`)
|
|
72
|
+
* @returns An LSP `Hover` response, or `null` if the tag is not recognized
|
|
73
|
+
*/
|
|
74
|
+
export declare function getHoverForTag(tagName: string): Hover | null;
|
|
75
|
+
|
|
76
|
+
export { }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion provider for FormSpec JSDoc constraint tags.
|
|
3
|
+
*
|
|
4
|
+
* Returns completion items for all recognized FormSpec JSDoc constraint tags
|
|
5
|
+
* (e.g., `@Minimum`, `@Maximum`, `@Pattern`), derived from
|
|
6
|
+
* `BUILTIN_CONSTRAINT_DEFINITIONS`. This is a skeleton — context-aware
|
|
7
|
+
* filtering will be added in a future phase.
|
|
8
|
+
*/
|
|
9
|
+
import type { CompletionItem } from "vscode-languageserver/node.js";
|
|
10
|
+
/**
|
|
11
|
+
* Returns completion items for all FormSpec JSDoc constraint tags.
|
|
12
|
+
*
|
|
13
|
+
* Items are derived from `BUILTIN_CONSTRAINT_DEFINITIONS`, ensuring this list
|
|
14
|
+
* stays in sync with the single source of truth in `@formspec/core`.
|
|
15
|
+
*
|
|
16
|
+
* Each item uses `CompletionItemKind.Keyword` since these are annotation
|
|
17
|
+
* tags used within JSDoc comments rather than language symbols.
|
|
18
|
+
*
|
|
19
|
+
* @returns An array of LSP completion items for FormSpec constraint tags
|
|
20
|
+
*/
|
|
21
|
+
export declare function getCompletionItems(): CompletionItem[];
|
|
22
|
+
//# sourceMappingURL=completion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/providers/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAoBpE;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,EAAE,CAOrD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Go-to-definition provider for FormSpec.
|
|
3
|
+
*
|
|
4
|
+
* This is a stub — go-to-definition support (e.g., navigating from a
|
|
5
|
+
* `field.text("name")` call to the form definition that references it) will
|
|
6
|
+
* be implemented in a future phase.
|
|
7
|
+
*/
|
|
8
|
+
import type { Location } from "vscode-languageserver/node.js";
|
|
9
|
+
/**
|
|
10
|
+
* Returns the definition location for a symbol at the given position.
|
|
11
|
+
*
|
|
12
|
+
* Always returns `null` in this stub implementation.
|
|
13
|
+
*
|
|
14
|
+
* @returns `null` — not yet implemented
|
|
15
|
+
*/
|
|
16
|
+
export declare function getDefinition(): Location | null;
|
|
17
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/providers/definition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,QAAQ,GAAG,IAAI,CAE/C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hover provider for FormSpec JSDoc constraint tags.
|
|
3
|
+
*
|
|
4
|
+
* Returns Markdown documentation for a recognized FormSpec JSDoc tag when
|
|
5
|
+
* the cursor is positioned over it. This is a skeleton — precise token
|
|
6
|
+
* detection within JSDoc comment ranges will be added in a future phase.
|
|
7
|
+
*/
|
|
8
|
+
import type { Hover } from "vscode-languageserver/node.js";
|
|
9
|
+
/**
|
|
10
|
+
* Returns hover documentation for a FormSpec JSDoc tag name.
|
|
11
|
+
*
|
|
12
|
+
* The tag name lookup is case-sensitive and matches the canonical casing used
|
|
13
|
+
* in `BUILTIN_CONSTRAINT_DEFINITIONS` (e.g., `"Minimum"`, `"Pattern"`).
|
|
14
|
+
* The `@` prefix is stripped before lookup if present.
|
|
15
|
+
* Returns `null` when the tag is not a recognized FormSpec constraint tag.
|
|
16
|
+
*
|
|
17
|
+
* @param tagName - The tag name to look up (e.g., `"Minimum"`, `"@Pattern"`)
|
|
18
|
+
* @returns An LSP `Hover` response, or `null` if the tag is not recognized
|
|
19
|
+
*/
|
|
20
|
+
export declare function getHoverForTag(tagName: string): Hover | null;
|
|
21
|
+
//# sourceMappingURL=hover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../src/providers/hover.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAoI3D;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAc5D"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FormSpec Language Server
|
|
3
|
+
*
|
|
4
|
+
* Sets up an LSP server connection and registers handlers for:
|
|
5
|
+
* - `textDocument/completion` — FormSpec JSDoc constraint tag completions
|
|
6
|
+
* - `textDocument/hover` — Documentation for recognized constraint tags
|
|
7
|
+
* - `textDocument/definition` — Go-to-definition (stub, returns null)
|
|
8
|
+
*
|
|
9
|
+
* Diagnostics are intentionally omitted per design decision A7.
|
|
10
|
+
*/
|
|
11
|
+
import { type Connection } from "vscode-languageserver/node.js";
|
|
12
|
+
/**
|
|
13
|
+
* Creates and configures the FormSpec language server connection.
|
|
14
|
+
*
|
|
15
|
+
* Registers LSP capability handlers and returns the connection.
|
|
16
|
+
* Call `connection.listen()` to start accepting messages.
|
|
17
|
+
*
|
|
18
|
+
* @returns The configured LSP connection (not yet listening)
|
|
19
|
+
*/
|
|
20
|
+
export declare function createServer(): Connection;
|
|
21
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,+BAA+B,CAAC;AAKvC;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,UAAU,CAgDzC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@formspec/language-server",
|
|
3
|
+
"version": "0.1.0-alpha.11",
|
|
4
|
+
"description": "Language server for FormSpec — completions, hover, and go-to-definition for JSDoc constraint tags",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/language-server.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/language-server.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"vscode-languageserver": "^9.0.1",
|
|
21
|
+
"vscode-languageserver-textdocument": "^1.0.12",
|
|
22
|
+
"@formspec/core": "0.1.0-alpha.11"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"vitest": "^3.0.0"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"formspec",
|
|
32
|
+
"language-server",
|
|
33
|
+
"lsp",
|
|
34
|
+
"typescript",
|
|
35
|
+
"json-schema"
|
|
36
|
+
],
|
|
37
|
+
"license": "UNLICENSED",
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsup && tsc --emitDeclarationOnly && api-extractor run --local",
|
|
40
|
+
"clean": "rm -rf dist temp",
|
|
41
|
+
"typecheck": "tsc --noEmit",
|
|
42
|
+
"test": "vitest run",
|
|
43
|
+
"api-extractor": "api-extractor run",
|
|
44
|
+
"api-extractor:local": "api-extractor run --local",
|
|
45
|
+
"api-documenter": "api-documenter markdown -i temp -o docs"
|
|
46
|
+
}
|
|
47
|
+
}
|