@formspec/language-server 0.1.0-alpha.22 → 0.1.0-alpha.25

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,312 @@
1
+ /**
2
+ * \@formspec/language-server
3
+ *
4
+ * Language server for FormSpec — provides completions, hover documentation,
5
+ * and go-to-definition for FormSpec JSDoc constraint tags (`@Minimum`,
6
+ * `@Maximum`, `@Pattern`, etc.) in TypeScript files.
7
+ *
8
+ * This package implements the Language Server Protocol (LSP) using the
9
+ * `vscode-languageserver` library. Cheap syntax-local behaviors stay in the
10
+ * LSP process, while TypeScript-project-aware semantics are supplied by
11
+ * `@formspec/ts-plugin` over a local manifest + IPC transport.
12
+ *
13
+ * The packaged server acts as a reference implementation over the composable
14
+ * completion, hover, and diagnostics helpers exported from this package.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import { createServer } from '@formspec/language-server';
19
+ *
20
+ * const connection = createServer();
21
+ * connection.listen();
22
+ * ```
23
+ *
24
+ * @packageDocumentation
25
+ */
26
+
27
+ import { CompletionItem } from 'vscode-languageserver/node.js';
28
+ import { Connection } from 'vscode-languageserver/node.js';
29
+ import { Diagnostic } from 'vscode-languageserver/node.js';
30
+ import type { ExtensionDefinition } from '@formspec/core';
31
+ import type { Hover } from 'vscode-languageserver/node.js';
32
+ import type { Location } from 'vscode-languageserver/node.js';
33
+ import type { TextDocument } from 'vscode-languageserver-textdocument';
34
+
35
+ /** @public */
36
+ export declare interface CommentSourceSpan {
37
+ readonly start: number;
38
+ readonly end: number;
39
+ }
40
+
41
+ /** @public */
42
+ export declare type CommentSpan = CommentSourceSpan;
43
+
44
+ /**
45
+ * Creates and configures the FormSpec language server connection.
46
+ *
47
+ * Registers LSP capability handlers and returns the connection.
48
+ * Call `connection.listen()` to start accepting messages.
49
+ *
50
+ * @returns The configured LSP connection (not yet listening)
51
+ * @public
52
+ */
53
+ export declare function createServer(options?: CreateServerOptions): Connection;
54
+
55
+ /**
56
+ * Public configuration for constructing the FormSpec language server.
57
+ *
58
+ * @public
59
+ */
60
+ export declare interface CreateServerOptions {
61
+ /** Optional extension definitions whose custom tags should be surfaced by tooling. */
62
+ readonly extensions?: readonly ExtensionDefinition[];
63
+ /** Optional workspace roots to use before initialize() provides them. */
64
+ readonly workspaceRoots?: readonly string[];
65
+ /** Set to false to disable tsserver-plugin semantic enrichment. */
66
+ readonly usePluginTransport?: boolean;
67
+ /** IPC timeout, in milliseconds, for semantic plugin requests. */
68
+ readonly pluginQueryTimeoutMs?: number;
69
+ /** Optional diagnostics publishing mode for the packaged reference LSP. */
70
+ readonly diagnosticsMode?: "off" | "plugin";
71
+ /** Source label to use when publishing plugin-derived diagnostics. */
72
+ readonly diagnosticSource?: string;
73
+ }
74
+
75
+ /**
76
+ * Converts a `file://` URI to an absolute filesystem path.
77
+ *
78
+ * Returns `null` for any URI that is not a valid `file://` URI (e.g. `untitled:`, `vscode-notebook-cell:`,
79
+ * malformed URIs). On Windows the returned path uses backslash separators as produced by
80
+ * `url.fileURLToPath`.
81
+ *
82
+ * @public
83
+ */
84
+ export declare function fileUriToPathOrNull(uri: string): string | null;
85
+
86
+ /**
87
+ * File-local diagnostic derived from comment parsing or semantic analysis.
88
+ *
89
+ * @public
90
+ */
91
+ export declare interface FormSpecAnalysisDiagnostic {
92
+ readonly code: string;
93
+ readonly category: FormSpecAnalysisDiagnosticCategory;
94
+ readonly message: string;
95
+ readonly range: CommentSpan;
96
+ readonly severity: "error" | "warning" | "info";
97
+ readonly relatedLocations: readonly FormSpecAnalysisDiagnosticLocation[];
98
+ readonly data: Record<string, FormSpecAnalysisDiagnosticDataValue>;
99
+ }
100
+
101
+ /**
102
+ * Machine-readable diagnostic category used by FormSpec tooling surfaces.
103
+ *
104
+ * @public
105
+ */
106
+ export declare type FormSpecAnalysisDiagnosticCategory = "tag-recognition" | "value-parsing" | "type-compatibility" | "target-resolution" | "constraint-validation" | "infrastructure";
107
+
108
+ /**
109
+ * Primitive structured values carried in diagnostic facts for white-label
110
+ * downstream rendering.
111
+ *
112
+ * @public
113
+ */
114
+ export declare type FormSpecAnalysisDiagnosticDataValue = string | number | boolean | readonly string[] | readonly number[] | readonly boolean[];
115
+
116
+ /**
117
+ * Additional source location associated with a diagnostic.
118
+ *
119
+ * @public
120
+ */
121
+ export declare interface FormSpecAnalysisDiagnosticLocation {
122
+ readonly filePath: string;
123
+ readonly range: CommentSpan;
124
+ readonly message?: string;
125
+ }
126
+
127
+ /** @public */
128
+ declare type FormSpecPlacement = "class" | "class-field" | "class-method" | "interface" | "interface-field" | "type-alias" | "type-alias-field" | "variable" | "function" | "function-parameter" | "method-parameter";
129
+
130
+ /**
131
+ * Cursor-scoped completion context serialized for transport between the
132
+ * semantic tsserver plugin and the lightweight LSP.
133
+ *
134
+ * @public
135
+ */
136
+ declare type FormSpecSerializedCompletionContext = {
137
+ readonly kind: "tag-name";
138
+ readonly prefix: string;
139
+ readonly availableTags: readonly FormSpecSerializedTagDefinition[];
140
+ } | {
141
+ readonly kind: "target";
142
+ readonly semantic: FormSpecSerializedTagSemanticContext;
143
+ } | {
144
+ readonly kind: "argument";
145
+ readonly semantic: FormSpecSerializedTagSemanticContext;
146
+ readonly valueLabels: readonly string[];
147
+ } | {
148
+ readonly kind: "none";
149
+ };
150
+
151
+ /**
152
+ * Hover payload for a single comment token under the cursor.
153
+ *
154
+ * @public
155
+ */
156
+ declare interface FormSpecSerializedHoverInfo {
157
+ readonly kind: "tag-name" | "target" | "argument";
158
+ readonly markdown: string;
159
+ }
160
+
161
+ /**
162
+ * Serializable subset of tag metadata needed by hover and completion UIs.
163
+ *
164
+ * @public
165
+ */
166
+ declare interface FormSpecSerializedTagDefinition {
167
+ readonly canonicalName: string;
168
+ readonly completionDetail: string;
169
+ readonly hoverMarkdown: string;
170
+ }
171
+
172
+ /**
173
+ * Semantic facts about one parsed tag, reduced to JSON-safe data for IPC.
174
+ *
175
+ * @public
176
+ */
177
+ declare interface FormSpecSerializedTagSemanticContext {
178
+ readonly tagName: string;
179
+ readonly tagDefinition: FormSpecSerializedTagDefinition | null;
180
+ readonly placement: FormSpecPlacement | null;
181
+ readonly supportedTargets: readonly FormSpecTargetKind[];
182
+ readonly targetCompletions: readonly string[];
183
+ readonly compatiblePathTargets: readonly string[];
184
+ readonly valueLabels: readonly string[];
185
+ readonly signatures: readonly FormSpecSerializedTagSignature[];
186
+ readonly tagHoverMarkdown: string | null;
187
+ readonly targetHoverMarkdown: string | null;
188
+ readonly argumentHoverMarkdown: string | null;
189
+ }
190
+
191
+ /**
192
+ * Serializable overload/signature summary for one comment tag form.
193
+ *
194
+ * @public
195
+ */
196
+ declare interface FormSpecSerializedTagSignature {
197
+ readonly label: string;
198
+ readonly placements: readonly FormSpecPlacement[];
199
+ }
200
+
201
+ /** @public */
202
+ declare type FormSpecTargetKind = "none" | "path" | "member" | "variant";
203
+
204
+ /**
205
+ * Returns the full set of tag-name completions currently known to FormSpec.
206
+ *
207
+ * @public
208
+ */
209
+ export declare function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[];
210
+
211
+ /**
212
+ * Returns completion items for the cursor position at `offset` in `documentText`.
213
+ *
214
+ * When `semanticContext` is supplied (e.g. from {@link getPluginCompletionContextForDocument}),
215
+ * it is used directly to produce target-value or tag-name completions. Pass `null` or omit it
216
+ * to fall back to syntax-only analysis, which works without the TypeScript plugin.
217
+ *
218
+ * @public
219
+ */
220
+ export declare function getCompletionItemsAtOffset(documentText: string, offset: number, extensions?: readonly ExtensionDefinition[], semanticContext?: FormSpecSerializedCompletionContext | null): CompletionItem[];
221
+
222
+ /**
223
+ * Returns the definition location for a symbol at the given position.
224
+ *
225
+ * Always returns `null` in this stub implementation.
226
+ *
227
+ * @returns `null` — not yet implemented
228
+ * @public
229
+ */
230
+ export declare function getDefinition(): Location | null;
231
+
232
+ /**
233
+ * Returns LSP hover content for the cursor position at `offset` in `documentText`.
234
+ *
235
+ * When `semanticHover` is supplied (e.g. from {@link getPluginHoverForDocument}), it is used
236
+ * directly as the hover source. Pass `null` or omit it to fall back to syntax-only analysis,
237
+ * which works without the TypeScript plugin. Returns `null` when the cursor is not over a
238
+ * recognised FormSpec tag.
239
+ *
240
+ * @public
241
+ */
242
+ export declare function getHoverAtOffset(documentText: string, offset: number, extensions?: readonly ExtensionDefinition[], semanticHover?: FormSpecSerializedHoverInfo | null): Hover | null;
243
+
244
+ /**
245
+ * Returns hover content for a single FormSpec tag name.
246
+ *
247
+ * @public
248
+ */
249
+ export declare function getHoverForTag(tagName: string, extensions?: readonly ExtensionDefinition[]): Hover | null;
250
+
251
+ /**
252
+ * Queries the FormSpec TypeScript plugin for semantic completion context at `offset` in the
253
+ * document identified by `filePath`.
254
+ *
255
+ * The workspace root containing `filePath` is located automatically from `workspaceRoots`. The
256
+ * plugin manifest is read from disk on each call. Returns `null` when no matching workspace root
257
+ * is found, the manifest is missing or invalid, the IPC socket is unavailable, the plugin times
258
+ * out (default 2 s), or the plugin's response was computed against a different version of the
259
+ * document than `documentText` (stale response guard).
260
+ *
261
+ * Pass the result to {@link getCompletionItemsAtOffset} as `semanticContext`.
262
+ *
263
+ * @public
264
+ */
265
+ export declare function getPluginCompletionContextForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, offset: number, timeoutMs?: number): Promise<FormSpecSerializedCompletionContext | null>;
266
+
267
+ /**
268
+ * Retrieves canonical FormSpec diagnostics for the current document revision
269
+ * from the plugin transport. Returns `null` when the transport is missing,
270
+ * stale, or invalid.
271
+ *
272
+ * @public
273
+ */
274
+ export declare function getPluginDiagnosticsForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, timeoutMs?: number): Promise<readonly FormSpecAnalysisDiagnostic[] | null>;
275
+
276
+ /**
277
+ * Queries the FormSpec TypeScript plugin for semantic hover information at `offset` in the
278
+ * document identified by `filePath`.
279
+ *
280
+ * The workspace root containing `filePath` is located automatically from `workspaceRoots`. The
281
+ * plugin manifest is read from disk on each call. Returns `null` when no matching workspace root
282
+ * is found, the manifest is missing or invalid, the IPC socket is unavailable, the plugin times
283
+ * out (default 2 s), or the plugin's response was computed against a different version of the
284
+ * document than `documentText` (stale response guard).
285
+ *
286
+ * Pass the result to {@link getHoverAtOffset} as `semanticHover`.
287
+ *
288
+ * @public
289
+ */
290
+ export declare function getPluginHoverForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, offset: number, timeoutMs?: number): Promise<FormSpecSerializedHoverInfo | null>;
291
+
292
+ /**
293
+ * Converts canonical FormSpec diagnostics into LSP diagnostics.
294
+ *
295
+ * Downstream consumers that want complete white-label control can ignore this
296
+ * helper and render their own messages from `code` + `data`.
297
+ *
298
+ * @public
299
+ */
300
+ export declare function toLspDiagnostics(document: TextDocument, diagnostics: readonly FormSpecAnalysisDiagnostic[], options?: ToLspDiagnosticsOptions): Diagnostic[];
301
+
302
+ /**
303
+ * Options for converting canonical FormSpec diagnostics into LSP diagnostics.
304
+ *
305
+ * @public
306
+ */
307
+ export declare interface ToLspDiagnosticsOptions {
308
+ /** Source label shown by LSP clients. Defaults to `formspec`. */
309
+ readonly source?: string;
310
+ }
311
+
312
+ export { }
@@ -0,0 +1,312 @@
1
+ /**
2
+ * \@formspec/language-server
3
+ *
4
+ * Language server for FormSpec — provides completions, hover documentation,
5
+ * and go-to-definition for FormSpec JSDoc constraint tags (`@Minimum`,
6
+ * `@Maximum`, `@Pattern`, etc.) in TypeScript files.
7
+ *
8
+ * This package implements the Language Server Protocol (LSP) using the
9
+ * `vscode-languageserver` library. Cheap syntax-local behaviors stay in the
10
+ * LSP process, while TypeScript-project-aware semantics are supplied by
11
+ * `@formspec/ts-plugin` over a local manifest + IPC transport.
12
+ *
13
+ * The packaged server acts as a reference implementation over the composable
14
+ * completion, hover, and diagnostics helpers exported from this package.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import { createServer } from '@formspec/language-server';
19
+ *
20
+ * const connection = createServer();
21
+ * connection.listen();
22
+ * ```
23
+ *
24
+ * @packageDocumentation
25
+ */
26
+
27
+ import { CompletionItem } from 'vscode-languageserver/node.js';
28
+ import { Connection } from 'vscode-languageserver/node.js';
29
+ import { Diagnostic } from 'vscode-languageserver/node.js';
30
+ import type { ExtensionDefinition } from '@formspec/core';
31
+ import type { Hover } from 'vscode-languageserver/node.js';
32
+ import type { Location } from 'vscode-languageserver/node.js';
33
+ import type { TextDocument } from 'vscode-languageserver-textdocument';
34
+
35
+ /** @public */
36
+ export declare interface CommentSourceSpan {
37
+ readonly start: number;
38
+ readonly end: number;
39
+ }
40
+
41
+ /** @public */
42
+ export declare type CommentSpan = CommentSourceSpan;
43
+
44
+ /**
45
+ * Creates and configures the FormSpec language server connection.
46
+ *
47
+ * Registers LSP capability handlers and returns the connection.
48
+ * Call `connection.listen()` to start accepting messages.
49
+ *
50
+ * @returns The configured LSP connection (not yet listening)
51
+ * @public
52
+ */
53
+ export declare function createServer(options?: CreateServerOptions): Connection;
54
+
55
+ /**
56
+ * Public configuration for constructing the FormSpec language server.
57
+ *
58
+ * @public
59
+ */
60
+ export declare interface CreateServerOptions {
61
+ /** Optional extension definitions whose custom tags should be surfaced by tooling. */
62
+ readonly extensions?: readonly ExtensionDefinition[];
63
+ /** Optional workspace roots to use before initialize() provides them. */
64
+ readonly workspaceRoots?: readonly string[];
65
+ /** Set to false to disable tsserver-plugin semantic enrichment. */
66
+ readonly usePluginTransport?: boolean;
67
+ /** IPC timeout, in milliseconds, for semantic plugin requests. */
68
+ readonly pluginQueryTimeoutMs?: number;
69
+ /** Optional diagnostics publishing mode for the packaged reference LSP. */
70
+ readonly diagnosticsMode?: "off" | "plugin";
71
+ /** Source label to use when publishing plugin-derived diagnostics. */
72
+ readonly diagnosticSource?: string;
73
+ }
74
+
75
+ /**
76
+ * Converts a `file://` URI to an absolute filesystem path.
77
+ *
78
+ * Returns `null` for any URI that is not a valid `file://` URI (e.g. `untitled:`, `vscode-notebook-cell:`,
79
+ * malformed URIs). On Windows the returned path uses backslash separators as produced by
80
+ * `url.fileURLToPath`.
81
+ *
82
+ * @public
83
+ */
84
+ export declare function fileUriToPathOrNull(uri: string): string | null;
85
+
86
+ /**
87
+ * File-local diagnostic derived from comment parsing or semantic analysis.
88
+ *
89
+ * @public
90
+ */
91
+ export declare interface FormSpecAnalysisDiagnostic {
92
+ readonly code: string;
93
+ readonly category: FormSpecAnalysisDiagnosticCategory;
94
+ readonly message: string;
95
+ readonly range: CommentSpan;
96
+ readonly severity: "error" | "warning" | "info";
97
+ readonly relatedLocations: readonly FormSpecAnalysisDiagnosticLocation[];
98
+ readonly data: Record<string, FormSpecAnalysisDiagnosticDataValue>;
99
+ }
100
+
101
+ /**
102
+ * Machine-readable diagnostic category used by FormSpec tooling surfaces.
103
+ *
104
+ * @public
105
+ */
106
+ export declare type FormSpecAnalysisDiagnosticCategory = "tag-recognition" | "value-parsing" | "type-compatibility" | "target-resolution" | "constraint-validation" | "infrastructure";
107
+
108
+ /**
109
+ * Primitive structured values carried in diagnostic facts for white-label
110
+ * downstream rendering.
111
+ *
112
+ * @public
113
+ */
114
+ export declare type FormSpecAnalysisDiagnosticDataValue = string | number | boolean | readonly string[] | readonly number[] | readonly boolean[];
115
+
116
+ /**
117
+ * Additional source location associated with a diagnostic.
118
+ *
119
+ * @public
120
+ */
121
+ export declare interface FormSpecAnalysisDiagnosticLocation {
122
+ readonly filePath: string;
123
+ readonly range: CommentSpan;
124
+ readonly message?: string;
125
+ }
126
+
127
+ /** @public */
128
+ declare type FormSpecPlacement = "class" | "class-field" | "class-method" | "interface" | "interface-field" | "type-alias" | "type-alias-field" | "variable" | "function" | "function-parameter" | "method-parameter";
129
+
130
+ /**
131
+ * Cursor-scoped completion context serialized for transport between the
132
+ * semantic tsserver plugin and the lightweight LSP.
133
+ *
134
+ * @public
135
+ */
136
+ declare type FormSpecSerializedCompletionContext = {
137
+ readonly kind: "tag-name";
138
+ readonly prefix: string;
139
+ readonly availableTags: readonly FormSpecSerializedTagDefinition[];
140
+ } | {
141
+ readonly kind: "target";
142
+ readonly semantic: FormSpecSerializedTagSemanticContext;
143
+ } | {
144
+ readonly kind: "argument";
145
+ readonly semantic: FormSpecSerializedTagSemanticContext;
146
+ readonly valueLabels: readonly string[];
147
+ } | {
148
+ readonly kind: "none";
149
+ };
150
+
151
+ /**
152
+ * Hover payload for a single comment token under the cursor.
153
+ *
154
+ * @public
155
+ */
156
+ declare interface FormSpecSerializedHoverInfo {
157
+ readonly kind: "tag-name" | "target" | "argument";
158
+ readonly markdown: string;
159
+ }
160
+
161
+ /**
162
+ * Serializable subset of tag metadata needed by hover and completion UIs.
163
+ *
164
+ * @public
165
+ */
166
+ declare interface FormSpecSerializedTagDefinition {
167
+ readonly canonicalName: string;
168
+ readonly completionDetail: string;
169
+ readonly hoverMarkdown: string;
170
+ }
171
+
172
+ /**
173
+ * Semantic facts about one parsed tag, reduced to JSON-safe data for IPC.
174
+ *
175
+ * @public
176
+ */
177
+ declare interface FormSpecSerializedTagSemanticContext {
178
+ readonly tagName: string;
179
+ readonly tagDefinition: FormSpecSerializedTagDefinition | null;
180
+ readonly placement: FormSpecPlacement | null;
181
+ readonly supportedTargets: readonly FormSpecTargetKind[];
182
+ readonly targetCompletions: readonly string[];
183
+ readonly compatiblePathTargets: readonly string[];
184
+ readonly valueLabels: readonly string[];
185
+ readonly signatures: readonly FormSpecSerializedTagSignature[];
186
+ readonly tagHoverMarkdown: string | null;
187
+ readonly targetHoverMarkdown: string | null;
188
+ readonly argumentHoverMarkdown: string | null;
189
+ }
190
+
191
+ /**
192
+ * Serializable overload/signature summary for one comment tag form.
193
+ *
194
+ * @public
195
+ */
196
+ declare interface FormSpecSerializedTagSignature {
197
+ readonly label: string;
198
+ readonly placements: readonly FormSpecPlacement[];
199
+ }
200
+
201
+ /** @public */
202
+ declare type FormSpecTargetKind = "none" | "path" | "member" | "variant";
203
+
204
+ /**
205
+ * Returns the full set of tag-name completions currently known to FormSpec.
206
+ *
207
+ * @public
208
+ */
209
+ export declare function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[];
210
+
211
+ /**
212
+ * Returns completion items for the cursor position at `offset` in `documentText`.
213
+ *
214
+ * When `semanticContext` is supplied (e.g. from {@link getPluginCompletionContextForDocument}),
215
+ * it is used directly to produce target-value or tag-name completions. Pass `null` or omit it
216
+ * to fall back to syntax-only analysis, which works without the TypeScript plugin.
217
+ *
218
+ * @public
219
+ */
220
+ export declare function getCompletionItemsAtOffset(documentText: string, offset: number, extensions?: readonly ExtensionDefinition[], semanticContext?: FormSpecSerializedCompletionContext | null): CompletionItem[];
221
+
222
+ /**
223
+ * Returns the definition location for a symbol at the given position.
224
+ *
225
+ * Always returns `null` in this stub implementation.
226
+ *
227
+ * @returns `null` — not yet implemented
228
+ * @public
229
+ */
230
+ export declare function getDefinition(): Location | null;
231
+
232
+ /**
233
+ * Returns LSP hover content for the cursor position at `offset` in `documentText`.
234
+ *
235
+ * When `semanticHover` is supplied (e.g. from {@link getPluginHoverForDocument}), it is used
236
+ * directly as the hover source. Pass `null` or omit it to fall back to syntax-only analysis,
237
+ * which works without the TypeScript plugin. Returns `null` when the cursor is not over a
238
+ * recognised FormSpec tag.
239
+ *
240
+ * @public
241
+ */
242
+ export declare function getHoverAtOffset(documentText: string, offset: number, extensions?: readonly ExtensionDefinition[], semanticHover?: FormSpecSerializedHoverInfo | null): Hover | null;
243
+
244
+ /**
245
+ * Returns hover content for a single FormSpec tag name.
246
+ *
247
+ * @public
248
+ */
249
+ export declare function getHoverForTag(tagName: string, extensions?: readonly ExtensionDefinition[]): Hover | null;
250
+
251
+ /**
252
+ * Queries the FormSpec TypeScript plugin for semantic completion context at `offset` in the
253
+ * document identified by `filePath`.
254
+ *
255
+ * The workspace root containing `filePath` is located automatically from `workspaceRoots`. The
256
+ * plugin manifest is read from disk on each call. Returns `null` when no matching workspace root
257
+ * is found, the manifest is missing or invalid, the IPC socket is unavailable, the plugin times
258
+ * out (default 2 s), or the plugin's response was computed against a different version of the
259
+ * document than `documentText` (stale response guard).
260
+ *
261
+ * Pass the result to {@link getCompletionItemsAtOffset} as `semanticContext`.
262
+ *
263
+ * @public
264
+ */
265
+ export declare function getPluginCompletionContextForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, offset: number, timeoutMs?: number): Promise<FormSpecSerializedCompletionContext | null>;
266
+
267
+ /**
268
+ * Retrieves canonical FormSpec diagnostics for the current document revision
269
+ * from the plugin transport. Returns `null` when the transport is missing,
270
+ * stale, or invalid.
271
+ *
272
+ * @public
273
+ */
274
+ export declare function getPluginDiagnosticsForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, timeoutMs?: number): Promise<readonly FormSpecAnalysisDiagnostic[] | null>;
275
+
276
+ /**
277
+ * Queries the FormSpec TypeScript plugin for semantic hover information at `offset` in the
278
+ * document identified by `filePath`.
279
+ *
280
+ * The workspace root containing `filePath` is located automatically from `workspaceRoots`. The
281
+ * plugin manifest is read from disk on each call. Returns `null` when no matching workspace root
282
+ * is found, the manifest is missing or invalid, the IPC socket is unavailable, the plugin times
283
+ * out (default 2 s), or the plugin's response was computed against a different version of the
284
+ * document than `documentText` (stale response guard).
285
+ *
286
+ * Pass the result to {@link getHoverAtOffset} as `semanticHover`.
287
+ *
288
+ * @public
289
+ */
290
+ export declare function getPluginHoverForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, offset: number, timeoutMs?: number): Promise<FormSpecSerializedHoverInfo | null>;
291
+
292
+ /**
293
+ * Converts canonical FormSpec diagnostics into LSP diagnostics.
294
+ *
295
+ * Downstream consumers that want complete white-label control can ignore this
296
+ * helper and render their own messages from `code` + `data`.
297
+ *
298
+ * @public
299
+ */
300
+ export declare function toLspDiagnostics(document: TextDocument, diagnostics: readonly FormSpecAnalysisDiagnostic[], options?: ToLspDiagnosticsOptions): Diagnostic[];
301
+
302
+ /**
303
+ * Options for converting canonical FormSpec diagnostics into LSP diagnostics.
304
+ *
305
+ * @public
306
+ */
307
+ export declare interface ToLspDiagnosticsOptions {
308
+ /** Source label shown by LSP clients. Defaults to `formspec`. */
309
+ readonly source?: string;
310
+ }
311
+
312
+ export { }