@formspec/language-server 0.1.0-alpha.19 → 0.1.0-alpha.20

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=plugin-client.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-client.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/plugin-client.test.ts"],"names":[],"mappings":""}
package/dist/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
@@ -29,246 +39,83 @@ module.exports = __toCommonJS(index_exports);
29
39
 
30
40
  // src/server.ts
31
41
  var import_node2 = require("vscode-languageserver/node.js");
42
+ var import_vscode_languageserver_textdocument = require("vscode-languageserver-textdocument");
32
43
 
33
44
  // src/providers/completion.ts
34
- var import_core = require("@formspec/core");
45
+ var import_analysis = require("@formspec/analysis");
35
46
  var import_node = require("vscode-languageserver/node.js");
36
- var CONSTRAINT_DETAIL = {
37
- minimum: "Minimum numeric value (inclusive). Example: `@minimum 0`",
38
- maximum: "Maximum numeric value (inclusive). Example: `@maximum 100`",
39
- exclusiveMinimum: "Minimum numeric value (exclusive). Example: `@exclusiveMinimum 0`",
40
- exclusiveMaximum: "Maximum numeric value (exclusive). Example: `@exclusiveMaximum 100`",
41
- multipleOf: "Value must be a multiple of this number. Example: `@multipleOf 0.01`",
42
- minLength: "Minimum string length. Example: `@minLength 1`",
43
- maxLength: "Maximum string length. Example: `@maxLength 255`",
44
- minItems: "Minimum number of array items. Example: `@minItems 1`",
45
- maxItems: "Maximum number of array items. Example: `@maxItems 10`",
46
- uniqueItems: "Require all array items to be distinct. Example: `@uniqueItems`",
47
- pattern: "Regular expression pattern for string validation. Example: `@pattern ^[a-z]+$`",
48
- enumOptions: 'Inline JSON array of allowed enum values. Example: `@enumOptions ["a","b","c"]`',
49
- const: 'Require a constant JSON value. Example: `@const "USD"`'
50
- };
51
47
  function getCompletionItems(extensions) {
52
- const builtins = Object.keys(import_core.BUILTIN_CONSTRAINT_DEFINITIONS).map(
53
- (name) => ({
54
- label: `@${name}`,
55
- kind: import_node.CompletionItemKind.Keyword,
56
- detail: CONSTRAINT_DETAIL[name]
57
- })
48
+ return (0, import_analysis.getConstraintTagDefinitions)(extensions).map((tag) => ({
49
+ label: `@${tag.canonicalName}`,
50
+ kind: import_node.CompletionItemKind.Keyword,
51
+ detail: tag.completionDetail
52
+ }));
53
+ }
54
+ function toCompletionItem(tag) {
55
+ return {
56
+ label: `@${tag.canonicalName}`,
57
+ kind: import_node.CompletionItemKind.Keyword,
58
+ detail: tag.completionDetail
59
+ };
60
+ }
61
+ function getCompletionItemsAtOffset(documentText, offset, extensions, semanticContext) {
62
+ if (semanticContext !== null && semanticContext !== void 0) {
63
+ if (semanticContext.kind === "target") {
64
+ return semanticContext.semantic.targetCompletions.map((target) => ({
65
+ label: target,
66
+ kind: target === "singular" || target === "plural" ? import_node.CompletionItemKind.EnumMember : import_node.CompletionItemKind.Field,
67
+ detail: `Target for @${semanticContext.semantic.tagName}`
68
+ }));
69
+ }
70
+ if (semanticContext.kind !== "tag-name") {
71
+ return [];
72
+ }
73
+ const normalizedPrefix2 = semanticContext.prefix.toLowerCase();
74
+ return semanticContext.availableTags.map(toCompletionItem).filter((item) => item.label.slice(1).toLowerCase().startsWith(normalizedPrefix2));
75
+ }
76
+ const resolvedContext = (0, import_analysis.getSemanticCommentCompletionContextAtOffset)(
77
+ documentText,
78
+ offset,
79
+ extensions ? { extensions } : void 0
58
80
  );
59
- const customItems = extensions?.flatMap(
60
- (extension) => (extension.constraintTags ?? []).map((tag) => ({
61
- label: `@${tag.tagName}`,
62
- kind: import_node.CompletionItemKind.Keyword,
63
- detail: `Extension constraint tag from ${extension.extensionId}`
64
- }))
65
- ) ?? [];
66
- return [...builtins, ...customItems];
81
+ if (resolvedContext.kind === "target") {
82
+ return resolvedContext.semantic.targetCompletions.map((target) => ({
83
+ label: target,
84
+ kind: target === "singular" || target === "plural" ? import_node.CompletionItemKind.EnumMember : import_node.CompletionItemKind.Field,
85
+ detail: `Target for @${resolvedContext.semantic.tag.normalizedTagName}`
86
+ }));
87
+ }
88
+ if (resolvedContext.kind !== "tag-name") {
89
+ return [];
90
+ }
91
+ const normalizedPrefix = resolvedContext.prefix.toLowerCase();
92
+ return resolvedContext.availableTags.map(toCompletionItem).filter((item) => item.label.slice(1).toLowerCase().startsWith(normalizedPrefix));
67
93
  }
68
94
 
69
95
  // src/providers/hover.ts
70
- var import_core2 = require("@formspec/core");
71
- var CONSTRAINT_HOVER_DOCS = {
72
- minimum: [
73
- "**@minimum** `<number>`",
74
- "",
75
- "Sets an inclusive lower bound on a numeric field.",
76
- "",
77
- "Maps to `minimum` in JSON Schema.",
78
- "",
79
- "**Example:**",
80
- "```typescript",
81
- "/** @minimum 0 */",
82
- "amount: number;",
83
- "```"
84
- ].join("\n"),
85
- maximum: [
86
- "**@maximum** `<number>`",
87
- "",
88
- "Sets an inclusive upper bound on a numeric field.",
89
- "",
90
- "Maps to `maximum` in JSON Schema.",
91
- "",
92
- "**Example:**",
93
- "```typescript",
94
- "/** @maximum 100 */",
95
- "percentage: number;",
96
- "```"
97
- ].join("\n"),
98
- exclusiveMinimum: [
99
- "**@exclusiveMinimum** `<number>`",
100
- "",
101
- "Sets an exclusive lower bound on a numeric field.",
102
- "",
103
- "Maps to `exclusiveMinimum` in JSON Schema.",
104
- "",
105
- "**Example:**",
106
- "```typescript",
107
- "/** @exclusiveMinimum 0 */",
108
- "positiveAmount: number;",
109
- "```"
110
- ].join("\n"),
111
- exclusiveMaximum: [
112
- "**@exclusiveMaximum** `<number>`",
113
- "",
114
- "Sets an exclusive upper bound on a numeric field.",
115
- "",
116
- "Maps to `exclusiveMaximum` in JSON Schema.",
117
- "",
118
- "**Example:**",
119
- "```typescript",
120
- "/** @exclusiveMaximum 1 */",
121
- "ratio: number;",
122
- "```"
123
- ].join("\n"),
124
- multipleOf: [
125
- "**@multipleOf** `<number>`",
126
- "",
127
- "Requires the numeric value to be a multiple of the given number.",
128
- "",
129
- "Maps to `multipleOf` in JSON Schema.",
130
- "",
131
- "**Example:**",
132
- "```typescript",
133
- "/** @multipleOf 0.01 */",
134
- "price: number;",
135
- "```"
136
- ].join("\n"),
137
- minLength: [
138
- "**@minLength** `<number>`",
139
- "",
140
- "Sets a minimum character length on a string field.",
141
- "",
142
- "Maps to `minLength` in JSON Schema.",
143
- "",
144
- "**Example:**",
145
- "```typescript",
146
- "/** @minLength 1 */",
147
- "name: string;",
148
- "```"
149
- ].join("\n"),
150
- maxLength: [
151
- "**@maxLength** `<number>`",
152
- "",
153
- "Sets a maximum character length on a string field.",
154
- "",
155
- "Maps to `maxLength` in JSON Schema.",
156
- "",
157
- "**Example:**",
158
- "```typescript",
159
- "/** @maxLength 255 */",
160
- "description: string;",
161
- "```"
162
- ].join("\n"),
163
- minItems: [
164
- "**@minItems** `<number>`",
165
- "",
166
- "Sets a minimum number of items in an array field.",
167
- "",
168
- "Maps to `minItems` in JSON Schema.",
169
- "",
170
- "**Example:**",
171
- "```typescript",
172
- "/** @minItems 1 */",
173
- "tags: string[];",
174
- "```"
175
- ].join("\n"),
176
- maxItems: [
177
- "**@maxItems** `<number>`",
178
- "",
179
- "Sets a maximum number of items in an array field.",
180
- "",
181
- "Maps to `maxItems` in JSON Schema.",
182
- "",
183
- "**Example:**",
184
- "```typescript",
185
- "/** @maxItems 10 */",
186
- "tags: string[];",
187
- "```"
188
- ].join("\n"),
189
- uniqueItems: [
190
- "**@uniqueItems**",
191
- "",
192
- "Requires all items in an array field to be distinct.",
193
- "",
194
- "Maps to `uniqueItems` in JSON Schema.",
195
- "",
196
- "**Example:**",
197
- "```typescript",
198
- "/** @uniqueItems */",
199
- "tags: string[];",
200
- "```"
201
- ].join("\n"),
202
- pattern: [
203
- "**@pattern** `<regex>`",
204
- "",
205
- "Sets a regular expression pattern that a string field must match.",
206
- "",
207
- "Maps to `pattern` in JSON Schema.",
208
- "",
209
- "**Example:**",
210
- "```typescript",
211
- "/** @pattern ^[a-z0-9]+$ */",
212
- "slug: string;",
213
- "```"
214
- ].join("\n"),
215
- enumOptions: [
216
- "**@enumOptions** `<json-array>`",
217
- "",
218
- "Specifies the allowed values for an enum field as an inline JSON array.",
219
- "",
220
- "Maps to `enum` in JSON Schema.",
221
- "",
222
- "**Example:**",
223
- "```typescript",
224
- '/** @enumOptions ["draft","sent","archived"] */',
225
- "status: string;",
226
- "```"
227
- ].join("\n"),
228
- const: [
229
- "**@const** `<json-literal>`",
230
- "",
231
- "Requires the field value to equal a single constant JSON value.",
232
- "",
233
- "Maps to `const` in JSON Schema.",
234
- "",
235
- "**Example:**",
236
- "```typescript",
237
- '/** @const "USD" */',
238
- "currency: string;",
239
- "```"
240
- ].join("\n")
241
- };
96
+ var import_analysis2 = require("@formspec/analysis");
242
97
  function getHoverForTag(tagName, extensions) {
243
98
  const raw = tagName.startsWith("@") ? tagName.slice(1) : tagName;
244
- const name = (0, import_core2.normalizeConstraintTagName)(raw);
245
- if (!(0, import_core2.isBuiltinConstraintName)(name)) {
246
- const registration = extensions?.flatMap(
247
- (extension) => (extension.constraintTags ?? []).map((tag) => ({
248
- extensionId: extension.extensionId,
249
- tag
250
- }))
251
- ).find(({ tag }) => tag.tagName === name);
252
- if (registration === void 0) {
253
- return null;
99
+ const definition = (0, import_analysis2.getTagDefinition)((0, import_analysis2.normalizeFormSpecTagName)(raw), extensions);
100
+ if (!definition) {
101
+ return null;
102
+ }
103
+ return {
104
+ contents: {
105
+ kind: "markdown",
106
+ value: definition.hoverMarkdown
254
107
  }
255
- return {
256
- contents: {
257
- kind: "markdown",
258
- value: [
259
- `**@${registration.tag.tagName}** \`<value>\``,
260
- "",
261
- `Extension-defined constraint tag from \`${registration.extensionId}\`.`,
262
- "",
263
- "Validated through the registered FormSpec extension surface."
264
- ].join("\n")
265
- }
266
- };
108
+ };
109
+ }
110
+ function getHoverAtOffset(documentText, offset, extensions, semanticHover) {
111
+ const hoverInfo = semanticHover ?? (0, import_analysis2.getCommentHoverInfoAtOffset)(documentText, offset, extensions ? { extensions } : void 0);
112
+ if (hoverInfo === null) {
113
+ return null;
267
114
  }
268
115
  return {
269
116
  contents: {
270
117
  kind: "markdown",
271
- value: CONSTRAINT_HOVER_DOCS[name]
118
+ value: hoverInfo.markdown
272
119
  }
273
120
  };
274
121
  }
@@ -278,16 +125,172 @@ function getDefinition() {
278
125
  return null;
279
126
  }
280
127
 
128
+ // src/plugin-client.ts
129
+ var import_promises = __toESM(require("fs/promises"), 1);
130
+ var import_node_net = __toESM(require("net"), 1);
131
+ var import_node_path = __toESM(require("path"), 1);
132
+ var import_node_url = require("url");
133
+ var import_analysis3 = require("@formspec/analysis");
134
+ var DEFAULT_PLUGIN_QUERY_TIMEOUT_MS = 2e3;
135
+ function getManifestPath(workspaceRoot) {
136
+ return (0, import_analysis3.getFormSpecManifestPath)(workspaceRoot);
137
+ }
138
+ function normalizeWorkspaceRoot(root) {
139
+ const resolved = import_node_path.default.resolve(root);
140
+ const parsed = import_node_path.default.parse(resolved);
141
+ let normalized = resolved;
142
+ while (normalized.length > parsed.root.length && normalized.endsWith(import_node_path.default.sep)) {
143
+ normalized = normalized.slice(0, -import_node_path.default.sep.length);
144
+ }
145
+ return normalized;
146
+ }
147
+ function getMatchingWorkspaceRoot(workspaceRoots, filePath) {
148
+ const normalizedFilePath = import_node_path.default.resolve(filePath);
149
+ const normalizedRoots = [...workspaceRoots].map(normalizeWorkspaceRoot).sort((left, right) => right.length - left.length);
150
+ return normalizedRoots.find(
151
+ (workspaceRoot) => normalizedFilePath === workspaceRoot || normalizedFilePath.startsWith(`${workspaceRoot}${import_node_path.default.sep}`)
152
+ ) ?? null;
153
+ }
154
+ async function readManifest(workspaceRoot) {
155
+ try {
156
+ const manifestText = await import_promises.default.readFile(getManifestPath(workspaceRoot), "utf8");
157
+ const manifest = JSON.parse(manifestText);
158
+ if (!(0, import_analysis3.isFormSpecAnalysisManifest)(manifest)) {
159
+ return null;
160
+ }
161
+ return manifest;
162
+ } catch {
163
+ return null;
164
+ }
165
+ }
166
+ async function sendSemanticQuery(manifest, query, timeoutMs = DEFAULT_PLUGIN_QUERY_TIMEOUT_MS) {
167
+ return new Promise((resolve) => {
168
+ const socket = import_node_net.default.createConnection(manifest.endpoint.address);
169
+ let buffer = "";
170
+ let settled = false;
171
+ const finish = (response) => {
172
+ if (settled) {
173
+ return;
174
+ }
175
+ settled = true;
176
+ socket.removeAllListeners("data");
177
+ socket.destroy();
178
+ resolve(response);
179
+ };
180
+ socket.setTimeout(timeoutMs, () => {
181
+ finish(null);
182
+ });
183
+ socket.setEncoding("utf8");
184
+ socket.on("connect", () => {
185
+ socket.write(`${JSON.stringify(query)}
186
+ `);
187
+ });
188
+ socket.on("data", (chunk) => {
189
+ buffer += String(chunk);
190
+ const newlineIndex = buffer.indexOf("\n");
191
+ if (newlineIndex < 0) {
192
+ return;
193
+ }
194
+ const payload = buffer.slice(0, newlineIndex);
195
+ buffer = buffer.slice(newlineIndex + 1);
196
+ try {
197
+ const response = JSON.parse(payload);
198
+ finish((0, import_analysis3.isFormSpecSemanticResponse)(response) ? response : null);
199
+ } catch {
200
+ finish(null);
201
+ }
202
+ });
203
+ socket.on("error", () => {
204
+ finish(null);
205
+ });
206
+ socket.on("close", () => {
207
+ finish(null);
208
+ });
209
+ });
210
+ }
211
+ function fileUriToPathOrNull(uri) {
212
+ try {
213
+ return (0, import_node_url.fileURLToPath)(uri);
214
+ } catch {
215
+ return null;
216
+ }
217
+ }
218
+ async function sendFileQuery(workspaceRoots, filePath, query, timeoutMs = DEFAULT_PLUGIN_QUERY_TIMEOUT_MS) {
219
+ const workspaceRoot = getMatchingWorkspaceRoot(workspaceRoots, filePath);
220
+ if (workspaceRoot === null) {
221
+ return null;
222
+ }
223
+ const manifest = await readManifest(workspaceRoot);
224
+ if (manifest === null) {
225
+ return null;
226
+ }
227
+ return sendSemanticQuery(manifest, query, timeoutMs);
228
+ }
229
+ async function getPluginCompletionContextForDocument(workspaceRoots, filePath, documentText, offset, timeoutMs = DEFAULT_PLUGIN_QUERY_TIMEOUT_MS) {
230
+ const response = await sendFileQuery(
231
+ workspaceRoots,
232
+ filePath,
233
+ {
234
+ protocolVersion: import_analysis3.FORMSPEC_ANALYSIS_PROTOCOL_VERSION,
235
+ kind: "completion",
236
+ filePath,
237
+ offset
238
+ },
239
+ timeoutMs
240
+ );
241
+ if (response?.kind !== "completion") {
242
+ return null;
243
+ }
244
+ return response.sourceHash === (0, import_analysis3.computeFormSpecTextHash)(documentText) ? response.context : null;
245
+ }
246
+ async function getPluginHoverForDocument(workspaceRoots, filePath, documentText, offset, timeoutMs = DEFAULT_PLUGIN_QUERY_TIMEOUT_MS) {
247
+ const response = await sendFileQuery(
248
+ workspaceRoots,
249
+ filePath,
250
+ {
251
+ protocolVersion: import_analysis3.FORMSPEC_ANALYSIS_PROTOCOL_VERSION,
252
+ kind: "hover",
253
+ filePath,
254
+ offset
255
+ },
256
+ timeoutMs
257
+ );
258
+ if (response?.kind !== "hover") {
259
+ return null;
260
+ }
261
+ return response.sourceHash === (0, import_analysis3.computeFormSpecTextHash)(documentText) ? response.hover : null;
262
+ }
263
+
281
264
  // src/server.ts
265
+ function dedupeWorkspaceRoots(workspaceRoots) {
266
+ return [...new Set(workspaceRoots)];
267
+ }
268
+ function getWorkspaceRootsFromInitializeParams(params) {
269
+ const workspaceFolders = params.workspaceFolders?.map((workspaceFolder) => fileUriToPathOrNull(workspaceFolder.uri)).filter((workspaceRoot) => workspaceRoot !== null) ?? [];
270
+ const rootUri = params.rootUri === null || params.rootUri === void 0 ? null : fileUriToPathOrNull(params.rootUri);
271
+ const rootPath = params.rootPath ?? null;
272
+ return dedupeWorkspaceRoots([
273
+ ...workspaceFolders,
274
+ ...rootUri === null ? [] : [rootUri],
275
+ ...rootPath === null ? [] : [rootPath]
276
+ ]);
277
+ }
282
278
  function createServer(options = {}) {
283
279
  const connection = (0, import_node2.createConnection)(import_node2.ProposedFeatures.all);
284
- connection.onInitialize(() => {
280
+ const documents = new import_node2.TextDocuments(import_vscode_languageserver_textdocument.TextDocument);
281
+ let workspaceRoots = [...options.workspaceRoots ?? []];
282
+ documents.listen(connection);
283
+ connection.onInitialize((params) => {
284
+ workspaceRoots = dedupeWorkspaceRoots([
285
+ ...getWorkspaceRootsFromInitializeParams(params),
286
+ ...workspaceRoots
287
+ ]);
285
288
  return {
286
289
  capabilities: {
287
290
  textDocumentSync: import_node2.TextDocumentSyncKind.Incremental,
288
291
  completionProvider: {
289
- // Trigger completions inside JSDoc comments when `@` is typed
290
- triggerCharacters: ["@"]
292
+ // Trigger completions inside JSDoc comments for tags and target specifiers
293
+ triggerCharacters: ["@", ":"]
291
294
  },
292
295
  hoverProvider: true,
293
296
  definitionProvider: true
@@ -298,11 +301,39 @@ function createServer(options = {}) {
298
301
  }
299
302
  };
300
303
  });
301
- connection.onCompletion(() => {
302
- return getCompletionItems(options.extensions);
304
+ connection.onCompletion(async (params) => {
305
+ const document = documents.get(params.textDocument.uri);
306
+ if (!document) {
307
+ return [];
308
+ }
309
+ const offset = document.offsetAt(params.position);
310
+ const documentText = document.getText();
311
+ const filePath = fileUriToPathOrNull(params.textDocument.uri);
312
+ const semanticContext = options.usePluginTransport === false || filePath === null ? null : await getPluginCompletionContextForDocument(
313
+ workspaceRoots,
314
+ filePath,
315
+ documentText,
316
+ offset,
317
+ options.pluginQueryTimeoutMs
318
+ );
319
+ return getCompletionItemsAtOffset(documentText, offset, options.extensions, semanticContext);
303
320
  });
304
- connection.onHover((_params) => {
305
- return getHoverForTag("", options.extensions);
321
+ connection.onHover(async (params) => {
322
+ const document = documents.get(params.textDocument.uri);
323
+ if (!document) {
324
+ return null;
325
+ }
326
+ const offset = document.offsetAt(params.position);
327
+ const documentText = document.getText();
328
+ const filePath = fileUriToPathOrNull(params.textDocument.uri);
329
+ const semanticHover = options.usePluginTransport === false || filePath === null ? null : await getPluginHoverForDocument(
330
+ workspaceRoots,
331
+ filePath,
332
+ documentText,
333
+ offset,
334
+ options.pluginQueryTimeoutMs
335
+ );
336
+ return getHoverAtOffset(documentText, offset, options.extensions, semanticHover);
306
337
  });
307
338
  connection.onDefinition((_params) => {
308
339
  return getDefinition();
@@ -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 type { CreateServerOptions } 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 type { ExtensionDefinition } from \"@formspec/core\";\nimport { getCompletionItems } from \"./providers/completion.js\";\nimport { getHoverForTag } from \"./providers/hover.js\";\nimport { getDefinition } from \"./providers/definition.js\";\n\nexport interface CreateServerOptions {\n /** Optional extension definitions whose custom tags should be surfaced by tooling. */\n readonly extensions?: readonly ExtensionDefinition[];\n}\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(options: CreateServerOptions = {}): 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(options.extensions);\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(\"\", options.extensions);\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 {\n BUILTIN_CONSTRAINT_DEFINITIONS,\n type BuiltinConstraintName,\n type ExtensionDefinition,\n} from \"@formspec/core\";\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 camelCase constraint names (matching keys in `BUILTIN_CONSTRAINT_DEFINITIONS`).\n * Values are shown as the detail string in completion items.\n */\nconst CONSTRAINT_DETAIL: Record<BuiltinConstraintName, 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 multipleOf: \"Value must be a multiple of this number. Example: `@multipleOf 0.01`\",\n minLength: \"Minimum string length. Example: `@minLength 1`\",\n maxLength: \"Maximum string length. Example: `@maxLength 255`\",\n minItems: \"Minimum number of array items. Example: `@minItems 1`\",\n maxItems: \"Maximum number of array items. Example: `@maxItems 10`\",\n uniqueItems: \"Require all array items to be distinct. Example: `@uniqueItems`\",\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 const: 'Require a constant JSON value. Example: `@const \"USD\"`',\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(extensions?: readonly ExtensionDefinition[]): CompletionItem[] {\n const builtins = (Object.keys(BUILTIN_CONSTRAINT_DEFINITIONS) as BuiltinConstraintName[]).map(\n (name) => ({\n label: `@${name}`,\n kind: CompletionItemKind.Keyword,\n detail: CONSTRAINT_DETAIL[name],\n })\n );\n\n const customItems =\n extensions?.flatMap((extension) =>\n (extension.constraintTags ?? []).map((tag) => ({\n label: `@${tag.tagName}`,\n kind: CompletionItemKind.Keyword,\n detail: `Extension constraint tag from ${extension.extensionId}`,\n }))\n ) ?? [];\n\n return [...builtins, ...customItems];\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 {\n normalizeConstraintTagName,\n isBuiltinConstraintName,\n type BuiltinConstraintName,\n type ExtensionDefinition,\n} 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 multipleOf: [\n \"**@multipleOf** `<number>`\",\n \"\",\n \"Requires the numeric value to be a multiple of the given number.\",\n \"\",\n \"Maps to `multipleOf` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @multipleOf 0.01 */\",\n \"price: 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 minItems: [\n \"**@minItems** `<number>`\",\n \"\",\n \"Sets a minimum number of items in an array field.\",\n \"\",\n \"Maps to `minItems` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @minItems 1 */\",\n \"tags: string[];\",\n \"```\",\n ].join(\"\\n\"),\n\n maxItems: [\n \"**@maxItems** `<number>`\",\n \"\",\n \"Sets a maximum number of items in an array field.\",\n \"\",\n \"Maps to `maxItems` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @maxItems 10 */\",\n \"tags: string[];\",\n \"```\",\n ].join(\"\\n\"),\n\n uniqueItems: [\n \"**@uniqueItems**\",\n \"\",\n \"Requires all items in an array field to be distinct.\",\n \"\",\n \"Maps to `uniqueItems` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n \"/** @uniqueItems */\",\n \"tags: 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\n const: [\n \"**@const** `<json-literal>`\",\n \"\",\n \"Requires the field value to equal a single constant JSON value.\",\n \"\",\n \"Maps to `const` in JSON Schema.\",\n \"\",\n \"**Example:**\",\n \"```typescript\",\n '/** @const \"USD\" */',\n \"currency: string;\",\n \"```\",\n ].join(\"\\n\"),\n} satisfies Record<BuiltinConstraintName, string>;\n\n/**\n * Returns hover documentation for a FormSpec JSDoc tag name.\n *\n * Accepts both camelCase (`\"minimum\"`) and PascalCase (`\"Minimum\"`) forms.\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(\n tagName: string,\n extensions?: readonly ExtensionDefinition[]\n): Hover | null {\n // Strip leading `@` prefix if present\n const raw = tagName.startsWith(\"@\") ? tagName.slice(1) : tagName;\n const name = normalizeConstraintTagName(raw);\n\n if (!isBuiltinConstraintName(name)) {\n const registration = extensions\n ?.flatMap((extension) =>\n (extension.constraintTags ?? []).map((tag) => ({\n extensionId: extension.extensionId,\n tag,\n }))\n )\n .find(({ tag }) => tag.tagName === name);\n\n if (registration === undefined) {\n return null;\n }\n\n return {\n contents: {\n kind: \"markdown\",\n value: [\n `**@${registration.tag.tagName}** \\`<value>\\``,\n \"\",\n `Extension-defined constraint tag from \\`${registration.extensionId}\\`.`,\n \"\",\n \"Validated through the registered FormSpec extension surface.\",\n ].join(\"\\n\"),\n },\n };\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;;;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;AAAA,MACR,MAAM;AAAA,MACN,OAAO,sBAAsB,IAAI;AAAA,IACnC;AAAA,EACF;AACF;;;ACjPO,SAAS,gBAAiC;AAC/C,SAAO;AACT;;;AHiBO,SAAS,aAAa,UAA+B,CAAC,GAAe;AAC1E,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,QAAQ,UAAU;AAAA,EAC9C,CAAC;AAED,aAAW,QAAQ,CAAC,YAAY;AAQ9B,WAAO,eAAe,IAAI,QAAQ,UAAU;AAAA,EAC9C,CAAC;AAED,aAAW,aAAa,CAAC,YAAY;AAEnC,WAAO,cAAc;AAAA,EACvB,CAAC;AAED,SAAO;AACT;","names":["import_node","import_core"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/server.ts","../src/providers/completion.ts","../src/providers/hover.ts","../src/providers/definition.ts","../src/plugin-client.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. Cheap syntax-local behaviors stay in the\n * LSP process, while TypeScript-project-aware semantics are supplied by\n * `@formspec/ts-plugin` over a local manifest + IPC transport.\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 type { CreateServerOptions } 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 TextDocuments,\n TextDocumentSyncKind,\n type Connection,\n type InitializeResult,\n} from \"vscode-languageserver/node.js\";\nimport type { ExtensionDefinition } from \"@formspec/core\";\nimport { TextDocument } from \"vscode-languageserver-textdocument\";\nimport { getCompletionItemsAtOffset } from \"./providers/completion.js\";\nimport { getHoverAtOffset } from \"./providers/hover.js\";\nimport { getDefinition } from \"./providers/definition.js\";\nimport {\n fileUriToPathOrNull,\n getPluginCompletionContextForDocument,\n getPluginHoverForDocument,\n} from \"./plugin-client.js\";\n\nfunction dedupeWorkspaceRoots(workspaceRoots: readonly string[]): string[] {\n return [...new Set(workspaceRoots)];\n}\n\nfunction getWorkspaceRootsFromInitializeParams(params: {\n readonly workspaceFolders?: readonly { readonly uri: string }[] | null;\n readonly rootUri?: string | null;\n readonly rootPath?: string | null;\n}): string[] {\n const workspaceFolders =\n params.workspaceFolders\n ?.map((workspaceFolder) => fileUriToPathOrNull(workspaceFolder.uri))\n .filter((workspaceRoot): workspaceRoot is string => workspaceRoot !== null) ?? [];\n const rootUri =\n params.rootUri === null || params.rootUri === undefined\n ? null\n : fileUriToPathOrNull(params.rootUri);\n const rootPath = params.rootPath ?? null;\n\n return dedupeWorkspaceRoots([\n ...workspaceFolders,\n ...(rootUri === null ? [] : [rootUri]),\n ...(rootPath === null ? [] : [rootPath]),\n ]);\n}\n\n/**\n * Public configuration for constructing the FormSpec language server.\n *\n * @public\n */\nexport interface CreateServerOptions {\n /** Optional extension definitions whose custom tags should be surfaced by tooling. */\n readonly extensions?: readonly ExtensionDefinition[];\n /** Optional workspace roots to use before initialize() provides them. */\n readonly workspaceRoots?: readonly string[];\n /** Set to false to disable tsserver-plugin semantic enrichment. */\n readonly usePluginTransport?: boolean;\n /** IPC timeout, in milliseconds, for semantic plugin requests. */\n readonly pluginQueryTimeoutMs?: number;\n}\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 * @public\n */\nexport function createServer(options: CreateServerOptions = {}): Connection {\n const connection = createConnection(ProposedFeatures.all);\n const documents = new TextDocuments(TextDocument);\n let workspaceRoots = [...(options.workspaceRoots ?? [])];\n\n documents.listen(connection);\n\n connection.onInitialize((params): InitializeResult => {\n workspaceRoots = dedupeWorkspaceRoots([\n ...getWorkspaceRootsFromInitializeParams(params),\n ...workspaceRoots,\n ]);\n\n return {\n capabilities: {\n textDocumentSync: TextDocumentSyncKind.Incremental,\n completionProvider: {\n // Trigger completions inside JSDoc comments for tags and target specifiers\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(async (params) => {\n const document = documents.get(params.textDocument.uri);\n if (!document) {\n return [];\n }\n\n const offset = document.offsetAt(params.position);\n const documentText = document.getText();\n const filePath = fileUriToPathOrNull(params.textDocument.uri);\n const semanticContext =\n options.usePluginTransport === false || filePath === null\n ? null\n : await getPluginCompletionContextForDocument(\n workspaceRoots,\n filePath,\n documentText,\n offset,\n options.pluginQueryTimeoutMs\n );\n\n return getCompletionItemsAtOffset(documentText, offset, options.extensions, semanticContext);\n });\n\n connection.onHover(async (params) => {\n const document = documents.get(params.textDocument.uri);\n if (!document) {\n return null;\n }\n\n const offset = document.offsetAt(params.position);\n const documentText = document.getText();\n const filePath = fileUriToPathOrNull(params.textDocument.uri);\n const semanticHover =\n options.usePluginTransport === false || filePath === null\n ? null\n : await getPluginHoverForDocument(\n workspaceRoots,\n filePath,\n documentText,\n offset,\n options.pluginQueryTimeoutMs\n );\n\n return getHoverAtOffset(documentText, offset, options.extensions, semanticHover);\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 * Uses the shared tag registry from `@formspec/analysis` so completions stay\n * aligned with the same metadata that powers linting and build-time analysis.\n */\n\nimport {\n type FormSpecSerializedCompletionContext,\n type FormSpecSerializedTagDefinition,\n getConstraintTagDefinitions,\n getSemanticCommentCompletionContextAtOffset,\n type TagDefinition,\n} from \"@formspec/analysis\";\nimport type { ExtensionDefinition } from \"@formspec/core\";\nimport { CompletionItem, CompletionItemKind } from \"vscode-languageserver/node.js\";\n\n/**\n * Returns the full set of tag-name completions currently known to FormSpec.\n *\n * @public\n */\nexport function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[] {\n return getConstraintTagDefinitions(extensions).map((tag) => ({\n label: `@${tag.canonicalName}`,\n kind: CompletionItemKind.Keyword,\n detail: tag.completionDetail,\n }));\n}\n\nfunction toCompletionItem(tag: TagDefinition | FormSpecSerializedTagDefinition): CompletionItem {\n return {\n label: `@${tag.canonicalName}`,\n kind: CompletionItemKind.Keyword,\n detail: tag.completionDetail,\n };\n}\n\n/** @internal */\nexport function getCompletionItemsAtOffset(\n documentText: string,\n offset: number,\n extensions?: readonly ExtensionDefinition[],\n semanticContext?: FormSpecSerializedCompletionContext | null\n): CompletionItem[] {\n if (semanticContext !== null && semanticContext !== undefined) {\n if (semanticContext.kind === \"target\") {\n return semanticContext.semantic.targetCompletions.map((target: string) => ({\n label: target,\n kind:\n target === \"singular\" || target === \"plural\"\n ? CompletionItemKind.EnumMember\n : CompletionItemKind.Field,\n detail: `Target for @${semanticContext.semantic.tagName}`,\n }));\n }\n\n if (semanticContext.kind !== \"tag-name\") {\n return [];\n }\n\n const normalizedPrefix = semanticContext.prefix.toLowerCase();\n return semanticContext.availableTags\n .map(toCompletionItem)\n .filter((item) => item.label.slice(1).toLowerCase().startsWith(normalizedPrefix));\n }\n\n const resolvedContext = getSemanticCommentCompletionContextAtOffset(\n documentText,\n offset,\n extensions ? { extensions } : undefined\n );\n\n if (resolvedContext.kind === \"target\") {\n return resolvedContext.semantic.targetCompletions.map((target: string) => ({\n label: target,\n kind:\n target === \"singular\" || target === \"plural\"\n ? CompletionItemKind.EnumMember\n : CompletionItemKind.Field,\n detail: `Target for @${resolvedContext.semantic.tag.normalizedTagName}`,\n }));\n }\n\n if (resolvedContext.kind !== \"tag-name\") {\n return [];\n }\n\n const normalizedPrefix = resolvedContext.prefix.toLowerCase();\n return resolvedContext.availableTags\n .map(toCompletionItem)\n .filter((item) => item.label.slice(1).toLowerCase().startsWith(normalizedPrefix));\n}\n","/**\n * Hover provider for FormSpec JSDoc tags.\n *\n * Uses the shared registry from `@formspec/analysis` so hover content stays in\n * sync with the tag inventory and overload metadata.\n */\n\nimport {\n type FormSpecSerializedHoverInfo,\n getCommentHoverInfoAtOffset,\n getTagDefinition,\n normalizeFormSpecTagName,\n} from \"@formspec/analysis\";\nimport type { ExtensionDefinition } from \"@formspec/core\";\nimport type { Hover } from \"vscode-languageserver/node.js\";\n\n/**\n * Returns hover content for a single FormSpec tag name.\n *\n * @public\n */\nexport function getHoverForTag(\n tagName: string,\n extensions?: readonly ExtensionDefinition[]\n): Hover | null {\n const raw = tagName.startsWith(\"@\") ? tagName.slice(1) : tagName;\n const definition = getTagDefinition(normalizeFormSpecTagName(raw), extensions);\n if (!definition) {\n return null;\n }\n\n return {\n contents: {\n kind: \"markdown\",\n value: definition.hoverMarkdown,\n },\n };\n}\n\n/** @internal */\nexport function getHoverAtOffset(\n documentText: string,\n offset: number,\n extensions?: readonly ExtensionDefinition[],\n semanticHover?: FormSpecSerializedHoverInfo | null\n): Hover | null {\n const hoverInfo =\n semanticHover ??\n getCommentHoverInfoAtOffset(documentText, offset, extensions ? { extensions } : undefined);\n if (hoverInfo === null) {\n return null;\n }\n\n return {\n contents: {\n kind: \"markdown\",\n value: hoverInfo.markdown,\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 * @public\n */\nexport function getDefinition(): Location | null {\n return null;\n}\n","import fs from \"node:fs/promises\";\nimport net from \"node:net\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport {\n FORMSPEC_ANALYSIS_PROTOCOL_VERSION,\n computeFormSpecTextHash,\n getFormSpecManifestPath,\n isFormSpecAnalysisManifest,\n isFormSpecSemanticResponse,\n type FormSpecAnalysisManifest,\n type FormSpecSerializedCompletionContext,\n type FormSpecSerializedHoverInfo,\n type FormSpecSemanticQuery,\n type FormSpecSemanticResponse,\n} from \"@formspec/analysis\";\n\nconst DEFAULT_PLUGIN_QUERY_TIMEOUT_MS = 2_000;\n\nfunction getManifestPath(workspaceRoot: string): string {\n return getFormSpecManifestPath(workspaceRoot);\n}\n\nfunction normalizeWorkspaceRoot(root: string): string {\n const resolved = path.resolve(root);\n const parsed = path.parse(resolved);\n let normalized = resolved;\n\n while (normalized.length > parsed.root.length && normalized.endsWith(path.sep)) {\n normalized = normalized.slice(0, -path.sep.length);\n }\n\n return normalized;\n}\n\nfunction getMatchingWorkspaceRoot(\n workspaceRoots: readonly string[],\n filePath: string\n): string | null {\n const normalizedFilePath = path.resolve(filePath);\n const normalizedRoots = [...workspaceRoots]\n .map(normalizeWorkspaceRoot)\n .sort((left, right) => right.length - left.length);\n return (\n normalizedRoots.find(\n (workspaceRoot) =>\n normalizedFilePath === workspaceRoot ||\n normalizedFilePath.startsWith(`${workspaceRoot}${path.sep}`)\n ) ?? null\n );\n}\n\nasync function readManifest(workspaceRoot: string): Promise<FormSpecAnalysisManifest | null> {\n try {\n const manifestText = await fs.readFile(getManifestPath(workspaceRoot), \"utf8\");\n const manifest = JSON.parse(manifestText) as unknown;\n if (!isFormSpecAnalysisManifest(manifest)) {\n return null;\n }\n\n return manifest;\n } catch {\n return null;\n }\n}\n\nasync function sendSemanticQuery(\n manifest: FormSpecAnalysisManifest,\n query: FormSpecSemanticQuery,\n timeoutMs = DEFAULT_PLUGIN_QUERY_TIMEOUT_MS\n): Promise<FormSpecSemanticResponse | null> {\n return new Promise((resolve) => {\n const socket = net.createConnection(manifest.endpoint.address);\n let buffer = \"\";\n let settled = false;\n\n const finish = (response: FormSpecSemanticResponse | null): void => {\n if (settled) {\n return;\n }\n settled = true;\n socket.removeAllListeners(\"data\");\n socket.destroy();\n resolve(response);\n };\n\n socket.setTimeout(timeoutMs, () => {\n finish(null);\n });\n\n socket.setEncoding(\"utf8\");\n socket.on(\"connect\", () => {\n socket.write(`${JSON.stringify(query)}\\n`);\n });\n socket.on(\"data\", (chunk) => {\n buffer += String(chunk);\n const newlineIndex = buffer.indexOf(\"\\n\");\n if (newlineIndex < 0) {\n return;\n }\n\n const payload = buffer.slice(0, newlineIndex);\n buffer = buffer.slice(newlineIndex + 1);\n try {\n const response = JSON.parse(payload) as unknown;\n finish(isFormSpecSemanticResponse(response) ? response : null);\n } catch {\n finish(null);\n }\n });\n socket.on(\"error\", () => {\n finish(null);\n });\n socket.on(\"close\", () => {\n finish(null);\n });\n });\n}\n\nexport function fileUriToPathOrNull(uri: string): string | null {\n try {\n return fileURLToPath(uri);\n } catch {\n return null;\n }\n}\n\nasync function sendFileQuery(\n workspaceRoots: readonly string[],\n filePath: string,\n query: FormSpecSemanticQuery,\n timeoutMs = DEFAULT_PLUGIN_QUERY_TIMEOUT_MS\n): Promise<FormSpecSemanticResponse | null> {\n const workspaceRoot = getMatchingWorkspaceRoot(workspaceRoots, filePath);\n if (workspaceRoot === null) {\n return null;\n }\n\n const manifest = await readManifest(workspaceRoot);\n if (manifest === null) {\n return null;\n }\n\n return sendSemanticQuery(manifest, query, timeoutMs);\n}\n\nexport async function getPluginCompletionContextForDocument(\n workspaceRoots: readonly string[],\n filePath: string,\n documentText: string,\n offset: number,\n timeoutMs = DEFAULT_PLUGIN_QUERY_TIMEOUT_MS\n): Promise<FormSpecSerializedCompletionContext | null> {\n const response = await sendFileQuery(\n workspaceRoots,\n filePath,\n {\n protocolVersion: FORMSPEC_ANALYSIS_PROTOCOL_VERSION,\n kind: \"completion\",\n filePath,\n offset,\n },\n timeoutMs\n );\n if (response?.kind !== \"completion\") {\n return null;\n }\n\n return response.sourceHash === computeFormSpecTextHash(documentText) ? response.context : null;\n}\n\nexport async function getPluginHoverForDocument(\n workspaceRoots: readonly string[],\n filePath: string,\n documentText: string,\n offset: number,\n timeoutMs = DEFAULT_PLUGIN_QUERY_TIMEOUT_MS\n): Promise<FormSpecSerializedHoverInfo | null> {\n const response = await sendFileQuery(\n workspaceRoots,\n filePath,\n {\n protocolVersion: FORMSPEC_ANALYSIS_PROTOCOL_VERSION,\n kind: \"hover\",\n filePath,\n offset,\n },\n timeoutMs\n );\n if (response?.kind !== \"hover\") {\n return null;\n }\n\n return response.sourceHash === computeFormSpecTextHash(documentText) ? response.hover : null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWA,IAAAA,eAOO;AAEP,gDAA6B;;;ACb7B,sBAMO;AAEP,kBAAmD;AAO5C,SAAS,mBAAmB,YAA+D;AAChG,aAAO,6CAA4B,UAAU,EAAE,IAAI,CAAC,SAAS;AAAA,IAC3D,OAAO,IAAI,IAAI,aAAa;AAAA,IAC5B,MAAM,+B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