@formspec/language-server 0.1.0-alpha.11 → 0.1.0-alpha.12
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 +96 -0
- package/dist/index.cjs +2 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/language-server.d.ts +1 -1
- package/dist/providers/completion.d.ts +1 -1
- package/dist/providers/completion.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @formspec/language-server
|
|
2
|
+
|
|
3
|
+
Language server protocol (LSP) features for FormSpec, providing editor intelligence for JSDoc constraint tags.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @formspec/language-server
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @formspec/language-server
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
This package is ESM-only and requires:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
// package.json
|
|
19
|
+
{
|
|
20
|
+
"type": "module"
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
// tsconfig.json
|
|
26
|
+
{
|
|
27
|
+
"compilerOptions": {
|
|
28
|
+
"module": "NodeNext",
|
|
29
|
+
"moduleResolution": "NodeNext"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Overview
|
|
35
|
+
|
|
36
|
+
This package provides language server features for FormSpec's JSDoc constraint tags (`@Minimum`, `@Maximum`, `@Pattern`, etc.). It can be integrated into any LSP-compatible editor.
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
|
|
40
|
+
- **Completion** — Autocomplete for constraint tag names inside JSDoc comments
|
|
41
|
+
- **Hover** — Documentation on hover for constraint tags
|
|
42
|
+
- **Go to Definition** — Navigate to constraint definitions *(placeholder — not yet implemented)*
|
|
43
|
+
|
|
44
|
+
## API Reference
|
|
45
|
+
|
|
46
|
+
### Functions
|
|
47
|
+
|
|
48
|
+
| Function | Description |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `createServer()` | Create a full LSP server connection |
|
|
51
|
+
| `getCompletionItems()` | Get completion items for constraint tags |
|
|
52
|
+
| `getDefinition()` | Get definition location for a constraint tag |
|
|
53
|
+
| `getHoverForTag(tagName)` | Get hover information for a constraint tag name |
|
|
54
|
+
|
|
55
|
+
### `createServer()`
|
|
56
|
+
|
|
57
|
+
Creates a Language Server Protocol connection that handles `initialize`, `textDocument/completion`, `textDocument/hover`, and `textDocument/definition` requests.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { createServer } from "@formspec/language-server";
|
|
61
|
+
|
|
62
|
+
const connection = createServer();
|
|
63
|
+
connection.listen();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### `getCompletionItems()`
|
|
67
|
+
|
|
68
|
+
Returns completion items for all known FormSpec constraint tags.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { getCompletionItems } from "@formspec/language-server";
|
|
72
|
+
|
|
73
|
+
const items = getCompletionItems();
|
|
74
|
+
// [{ label: "@Minimum", kind: CompletionItemKind.Keyword, ... }, ...]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### `getHoverForTag(tagName)`
|
|
78
|
+
|
|
79
|
+
Returns hover documentation for a given tag name, or `null` if the tag is not recognized.
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { getHoverForTag } from "@formspec/language-server";
|
|
83
|
+
|
|
84
|
+
const hover = getHoverForTag("Minimum");
|
|
85
|
+
// { contents: { kind: "markdown", value: "..." } }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Editor Integration
|
|
89
|
+
|
|
90
|
+
### VS Code
|
|
91
|
+
|
|
92
|
+
Use with a VS Code extension that connects to the language server. The server communicates over the standard LSP protocol via `vscode-languageserver/node.js`.
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
UNLICENSED
|
package/dist/index.cjs
CHANGED
|
@@ -190,11 +190,8 @@ function createServer() {
|
|
|
190
190
|
// Trigger completions inside JSDoc comments when `@` is typed
|
|
191
191
|
triggerCharacters: ["@"]
|
|
192
192
|
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
// so clients don't enable UI affordances that never resolve.
|
|
196
|
-
hoverProvider: false,
|
|
197
|
-
definitionProvider: false
|
|
193
|
+
hoverProvider: true,
|
|
194
|
+
definitionProvider: true
|
|
198
195
|
},
|
|
199
196
|
serverInfo: {
|
|
200
197
|
name: "formspec-language-server",
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWA,IAAAA,eAMO;;;ACPP,kBAAmC;AAQnC,IAAM,oBAA4C;AAAA,EAChD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,aAAa;AACf;AAaO,SAAS,qBAAuC;AACrD,SAAO,OAAO,QAAQ,iBAAiB,EAAE,IAAI,CAAC,CAAC,MAAM,MAAM,OAAO;AAAA,IAEhE,OAAO,IAAI,IAAI;AAAA,IACf,MAAM,+BAAmB;AAAA,IACzB;AAAA,EACF,EAAE;AACJ;;;ACvCA,kBAA2E;AAS3E,IAAM,wBAA+D;AAAA,EACnE,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AAAA,EAEX,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,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;AAE1D,MAAI,CAAC,wBAAwB,IAAI,GAAG;AAClC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO,sBAAsB,IAAI;AAAA,IACnC;AAAA,EACF;AACF;;;ACrJO,SAAS,gBAAiC;AAC/C,SAAO;AACT;;;AHWO,SAAS,eAA2B;AACzC,QAAM,iBAAa,+BAAiB,8BAAiB,GAAG;AAExD,aAAW,aAAa,MAAwB;AAC9C,WAAO;AAAA,MACL,cAAc;AAAA,QACZ,kBAAkB,kCAAqB;AAAA,QACvC,oBAAoB;AAAA;AAAA,UAElB,mBAAmB,CAAC,GAAG;AAAA,QACzB;AAAA;AAAA;AAAA;AAAA,QAIA,eAAe;AAAA,QACf,oBAAoB;AAAA,MACtB;AAAA,MACA,YAAY;AAAA,QACV,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF,CAAC;AAED,aAAW,aAAa,MAAM;AAI5B,WAAO,mBAAmB;AAAA,EAC5B,CAAC;AAED,aAAW,QAAQ,CAAC,YAAY;AAQ9B,WAAO,eAAe,EAAE;AAAA,EAC1B,CAAC;AAED,aAAW,aAAa,CAAC,YAAY;AAEnC,WAAO,cAAc;AAAA,EACvB,CAAC;AAED,SAAO;AACT;","names":["import_node"]}
|
|
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 hoverProvider: true,\n definitionProvider: true,\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 { CompletionItem, 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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWA,IAAAA,eAMO;;;ACRP,kBAAmD;AAQnD,IAAM,oBAA4C;AAAA,EAChD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,aAAa;AACf;AAaO,SAAS,qBAAuC;AACrD,SAAO,OAAO,QAAQ,iBAAiB,EAAE,IAAI,CAAC,CAAC,MAAM,MAAM,OAAO;AAAA,IAEhE,OAAO,IAAI,IAAI;AAAA,IACf,MAAM,+BAAmB;AAAA,IACzB;AAAA,EACF,EAAE;AACJ;;;ACtCA,kBAA2E;AAS3E,IAAM,wBAA+D;AAAA,EACnE,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA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SAAS,wBAAwB,MAA6C;AAC5E,SAAO,OAAO,UAAU,eAAe,KAAK,4CAAgC,IAAI;AAClF;AAaO,SAAS,eAAe,SAA+B;AAE5D,QAAM,OAAO,QAAQ,WAAW,GAAG,IAAI,QAAQ,MAAM,CAAC,IAAI;AAE1D,MAAI,CAAC,wBAAwB,IAAI,GAAG;AAClC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO,sBAAsB,IAAI;AAAA,IACnC;AAAA,EACF;AACF;;;ACrJO,SAAS,gBAAiC;AAC/C,SAAO;AACT;;;AHWO,SAAS,eAA2B;AACzC,QAAM,iBAAa,+BAAiB,8BAAiB,GAAG;AAExD,aAAW,aAAa,MAAwB;AAC9C,WAAO;AAAA,MACL,cAAc;AAAA,QACZ,kBAAkB,kCAAqB;AAAA,QACvC,oBAAoB;AAAA;AAAA,UAElB,mBAAmB,CAAC,GAAG;AAAA,QACzB;AAAA,QACA,eAAe;AAAA,QACf,oBAAoB;AAAA,MACtB;AAAA,MACA,YAAY;AAAA,QACV,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF,CAAC;AAED,aAAW,aAAa,MAAM;AAI5B,WAAO,mBAAmB;AAAA,EAC5B,CAAC;AAED,aAAW,QAAQ,CAAC,YAAY;AAQ9B,WAAO,eAAe,EAAE;AAAA,EAC1B,CAAC;AAED,aAAW,aAAa,CAAC,YAAY;AAEnC,WAAO,cAAc;AAAA,EACvB,CAAC;AAED,SAAO;AACT;","names":["import_node"]}
|
package/dist/index.js
CHANGED
|
@@ -165,11 +165,8 @@ function createServer() {
|
|
|
165
165
|
// Trigger completions inside JSDoc comments when `@` is typed
|
|
166
166
|
triggerCharacters: ["@"]
|
|
167
167
|
},
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// so clients don't enable UI affordances that never resolve.
|
|
171
|
-
hoverProvider: false,
|
|
172
|
-
definitionProvider: false
|
|
168
|
+
hoverProvider: true,
|
|
169
|
+
definitionProvider: true
|
|
173
170
|
},
|
|
174
171
|
serverInfo: {
|
|
175
172
|
name: "formspec-language-server",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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":";AAWA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;;;ACPP,SAAS,0BAA0B;AAQnC,IAAM,oBAA4C;AAAA,EAChD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,aAAa;AACf;AAaO,SAAS,qBAAuC;AACrD,SAAO,OAAO,QAAQ,iBAAiB,EAAE,IAAI,CAAC,CAAC,MAAM,MAAM,OAAO;AAAA,IAEhE,OAAO,IAAI,IAAI;AAAA,IACf,MAAM,mBAAmB;AAAA,IACzB;AAAA,EACF,EAAE;AACJ;;;ACvCA,SAAS,sCAAkE;AAS3E,IAAM,wBAA+D;AAAA,EAC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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACb;AAQA,SAAS,wBAAwB,MAA6C;AAC5E,SAAO,OAAO,UAAU,eAAe,KAAK,gCAAgC,IAAI;AAClF;AAaO,SAAS,eAAe,SAA+B;AAE5D,QAAM,OAAO,QAAQ,WAAW,GAAG,IAAI,QAAQ,MAAM,CAAC,IAAI;AAE1D,MAAI,CAAC,wBAAwB,IAAI,GAAG;AAClC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO,sBAAsB,IAAI;AAAA,IACnC;AAAA,EACF;AACF;;;ACrJO,SAAS,gBAAiC;AAC/C,SAAO;AACT;;;AHWO,SAAS,eAA2B;AACzC,QAAM,aAAa,iBAAiB,iBAAiB,GAAG;AAExD,aAAW,aAAa,MAAwB;AAC9C,WAAO;AAAA,MACL,cAAc;AAAA,QACZ,kBAAkB,qBAAqB;AAAA,QACvC,oBAAoB;AAAA;AAAA,UAElB,mBAAmB,CAAC,GAAG;AAAA,QACzB;AAAA;AAAA;AAAA;AAAA,QAIA,eAAe;AAAA,QACf,oBAAoB;AAAA,MACtB;AAAA,MACA,YAAY;AAAA,QACV,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF,CAAC;AAED,aAAW,aAAa,MAAM;AAI5B,WAAO,mBAAmB;AAAA,EAC5B,CAAC;AAED,aAAW,QAAQ,CAAC,YAAY;AAQ9B,WAAO,eAAe,EAAE;AAAA,EAC1B,CAAC;AAED,aAAW,aAAa,CAAC,YAAY;AAEnC,WAAO,cAAc;AAAA,EACvB,CAAC;AAED,SAAO;AACT;","names":[]}
|
|
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 hoverProvider: true,\n definitionProvider: true,\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 { CompletionItem, 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":";AAWA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;;;ACRP,SAAyB,0BAA0B;AAQnD,IAAM,oBAA4C;AAAA,EAChD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,aAAa;AACf;AAaO,SAAS,qBAAuC;AACrD,SAAO,OAAO,QAAQ,iBAAiB,EAAE,IAAI,CAAC,CAAC,MAAM,MAAM,OAAO;AAAA,IAEhE,OAAO,IAAI,IAAI;AAAA,IACf,MAAM,mBAAmB;AAAA,IACzB;AAAA,EACF,EAAE;AACJ;;;ACtCA,SAAS,sCAAkE;AAS3E,IAAM,wBAA+D;AAAA,EACnE,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AAAA,EAEX,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AAAA,EAEX,kBAAkB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA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MAAM;AAAA,MACN,OAAO,sBAAsB,IAAI;AAAA,IACnC;AAAA,EACF;AACF;;;ACrJO,SAAS,gBAAiC;AAC/C,SAAO;AACT;;;AHWO,SAAS,eAA2B;AACzC,QAAM,aAAa,iBAAiB,iBAAiB,GAAG;AAExD,aAAW,aAAa,MAAwB;AAC9C,WAAO;AAAA,MACL,cAAc;AAAA,QACZ,kBAAkB,qBAAqB;AAAA,QACvC,oBAAoB;AAAA;AAAA,UAElB,mBAAmB,CAAC,GAAG;AAAA,QACzB;AAAA,QACA,eAAe;AAAA,QACf,oBAAoB;AAAA,MACtB;AAAA,MACA,YAAY;AAAA,QACV,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF,CAAC;AAED,aAAW,aAAa,MAAM;AAI5B,WAAO,mBAAmB;AAAA,EAC5B,CAAC;AAED,aAAW,QAAQ,CAAC,YAAY;AAQ9B,WAAO,eAAe,EAAE;AAAA,EAC1B,CAAC;AAED,aAAW,aAAa,CAAC,YAAY;AAEnC,WAAO,cAAc;AAAA,EACvB,CAAC;AAED,SAAO;AACT;","names":[]}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @packageDocumentation
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import
|
|
26
|
+
import { CompletionItem } from 'vscode-languageserver/node.js';
|
|
27
27
|
import { Connection } from 'vscode-languageserver/node.js';
|
|
28
28
|
import type { Hover } from 'vscode-languageserver/node.js';
|
|
29
29
|
import type { Location } from 'vscode-languageserver/node.js';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* `BUILTIN_CONSTRAINT_DEFINITIONS`. This is a skeleton — context-aware
|
|
7
7
|
* filtering will be added in a future phase.
|
|
8
8
|
*/
|
|
9
|
-
import
|
|
9
|
+
import { CompletionItem } from "vscode-languageserver/node.js";
|
|
10
10
|
/**
|
|
11
11
|
* Returns completion items for all FormSpec JSDoc constraint tags.
|
|
12
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/providers/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/providers/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAsB,MAAM,+BAA+B,CAAC;AAmBnF;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,EAAE,CAOrD"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
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,CA6CzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formspec/language-server",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.12",
|
|
4
4
|
"description": "Language server for FormSpec — completions, hover, and go-to-definition for JSDoc constraint tags",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"dist"
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
18
19
|
],
|
|
19
20
|
"dependencies": {
|
|
20
21
|
"vscode-languageserver": "^9.0.1",
|
|
21
22
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
22
|
-
"@formspec/core": "0.1.0-alpha.
|
|
23
|
+
"@formspec/core": "0.1.0-alpha.12"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"vitest": "^3.0.0"
|