@formspec/language-server 0.1.0-alpha.23 → 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.
@@ -33,11 +33,14 @@ import type { Location } from 'vscode-languageserver/node.js';
33
33
  import type { TextDocument } from 'vscode-languageserver-textdocument';
34
34
 
35
35
  /** @public */
36
- export declare interface CommentSpan {
36
+ export declare interface CommentSourceSpan {
37
37
  readonly start: number;
38
38
  readonly end: number;
39
39
  }
40
40
 
41
+ /** @public */
42
+ export declare type CommentSpan = CommentSourceSpan;
43
+
41
44
  /**
42
45
  * Creates and configures the FormSpec language server connection.
43
46
  *
@@ -69,6 +72,17 @@ export declare interface CreateServerOptions {
69
72
  readonly diagnosticSource?: string;
70
73
  }
71
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
+
72
86
  /**
73
87
  * File-local diagnostic derived from comment parsing or semantic analysis.
74
88
  *
@@ -110,6 +124,83 @@ export declare interface FormSpecAnalysisDiagnosticLocation {
110
124
  readonly message?: string;
111
125
  }
112
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
+
113
204
  /**
114
205
  * Returns the full set of tag-name completions currently known to FormSpec.
115
206
  *
@@ -117,6 +208,17 @@ export declare interface FormSpecAnalysisDiagnosticLocation {
117
208
  */
118
209
  export declare function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[];
119
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
+
120
222
  /**
121
223
  * Returns the definition location for a symbol at the given position.
122
224
  *
@@ -127,6 +229,18 @@ export declare function getCompletionItems(extensions?: readonly ExtensionDefini
127
229
  */
128
230
  export declare function getDefinition(): Location | null;
129
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
+
130
244
  /**
131
245
  * Returns hover content for a single FormSpec tag name.
132
246
  *
@@ -134,6 +248,22 @@ export declare function getDefinition(): Location | null;
134
248
  */
135
249
  export declare function getHoverForTag(tagName: string, extensions?: readonly ExtensionDefinition[]): Hover | null;
136
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
+
137
267
  /**
138
268
  * Retrieves canonical FormSpec diagnostics for the current document revision
139
269
  * from the plugin transport. Returns `null` when the transport is missing,
@@ -143,6 +273,22 @@ export declare function getHoverForTag(tagName: string, extensions?: readonly Ex
143
273
  */
144
274
  export declare function getPluginDiagnosticsForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, timeoutMs?: number): Promise<readonly FormSpecAnalysisDiagnostic[] | null>;
145
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
+
146
292
  /**
147
293
  * Converts canonical FormSpec diagnostics into LSP diagnostics.
148
294
  *
@@ -33,11 +33,14 @@ import type { Location } from 'vscode-languageserver/node.js';
33
33
  import type { TextDocument } from 'vscode-languageserver-textdocument';
34
34
 
35
35
  /** @public */
36
- export declare interface CommentSpan {
36
+ export declare interface CommentSourceSpan {
37
37
  readonly start: number;
38
38
  readonly end: number;
39
39
  }
40
40
 
41
+ /** @public */
42
+ export declare type CommentSpan = CommentSourceSpan;
43
+
41
44
  /**
42
45
  * Creates and configures the FormSpec language server connection.
43
46
  *
@@ -69,6 +72,17 @@ export declare interface CreateServerOptions {
69
72
  readonly diagnosticSource?: string;
70
73
  }
71
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
+
72
86
  /**
73
87
  * File-local diagnostic derived from comment parsing or semantic analysis.
74
88
  *
@@ -110,6 +124,83 @@ export declare interface FormSpecAnalysisDiagnosticLocation {
110
124
  readonly message?: string;
111
125
  }
112
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
+
113
204
  /**
114
205
  * Returns the full set of tag-name completions currently known to FormSpec.
115
206
  *
@@ -117,6 +208,17 @@ export declare interface FormSpecAnalysisDiagnosticLocation {
117
208
  */
118
209
  export declare function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[];
119
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
+
120
222
  /**
121
223
  * Returns the definition location for a symbol at the given position.
122
224
  *
@@ -127,6 +229,18 @@ export declare function getCompletionItems(extensions?: readonly ExtensionDefini
127
229
  */
128
230
  export declare function getDefinition(): Location | null;
129
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
+
130
244
  /**
131
245
  * Returns hover content for a single FormSpec tag name.
132
246
  *
@@ -134,6 +248,22 @@ export declare function getDefinition(): Location | null;
134
248
  */
135
249
  export declare function getHoverForTag(tagName: string, extensions?: readonly ExtensionDefinition[]): Hover | null;
136
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
+
137
267
  /**
138
268
  * Retrieves canonical FormSpec diagnostics for the current document revision
139
269
  * from the plugin transport. Returns `null` when the transport is missing,
@@ -143,6 +273,22 @@ export declare function getHoverForTag(tagName: string, extensions?: readonly Ex
143
273
  */
144
274
  export declare function getPluginDiagnosticsForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, timeoutMs?: number): Promise<readonly FormSpecAnalysisDiagnostic[] | null>;
145
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
+
146
292
  /**
147
293
  * Converts canonical FormSpec diagnostics into LSP diagnostics.
148
294
  *
@@ -33,11 +33,14 @@ import type { Location } from 'vscode-languageserver/node.js';
33
33
  import type { TextDocument } from 'vscode-languageserver-textdocument';
34
34
 
35
35
  /** @public */
36
- export declare interface CommentSpan {
36
+ export declare interface CommentSourceSpan {
37
37
  readonly start: number;
38
38
  readonly end: number;
39
39
  }
40
40
 
41
+ /** @public */
42
+ export declare type CommentSpan = CommentSourceSpan;
43
+
41
44
  /**
42
45
  * Creates and configures the FormSpec language server connection.
43
46
  *
@@ -69,6 +72,17 @@ export declare interface CreateServerOptions {
69
72
  readonly diagnosticSource?: string;
70
73
  }
71
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
+
72
86
  /**
73
87
  * File-local diagnostic derived from comment parsing or semantic analysis.
74
88
  *
@@ -110,6 +124,83 @@ export declare interface FormSpecAnalysisDiagnosticLocation {
110
124
  readonly message?: string;
111
125
  }
112
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
+
113
204
  /**
114
205
  * Returns the full set of tag-name completions currently known to FormSpec.
115
206
  *
@@ -117,6 +208,17 @@ export declare interface FormSpecAnalysisDiagnosticLocation {
117
208
  */
118
209
  export declare function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[];
119
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
+
120
222
  /**
121
223
  * Returns the definition location for a symbol at the given position.
122
224
  *
@@ -127,6 +229,18 @@ export declare function getCompletionItems(extensions?: readonly ExtensionDefini
127
229
  */
128
230
  export declare function getDefinition(): Location | null;
129
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
+
130
244
  /**
131
245
  * Returns hover content for a single FormSpec tag name.
132
246
  *
@@ -134,6 +248,22 @@ export declare function getDefinition(): Location | null;
134
248
  */
135
249
  export declare function getHoverForTag(tagName: string, extensions?: readonly ExtensionDefinition[]): Hover | null;
136
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
+
137
267
  /**
138
268
  * Retrieves canonical FormSpec diagnostics for the current document revision
139
269
  * from the plugin transport. Returns `null` when the transport is missing,
@@ -143,6 +273,22 @@ export declare function getHoverForTag(tagName: string, extensions?: readonly Ex
143
273
  */
144
274
  export declare function getPluginDiagnosticsForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, timeoutMs?: number): Promise<readonly FormSpecAnalysisDiagnostic[] | null>;
145
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
+
146
292
  /**
147
293
  * Converts canonical FormSpec diagnostics into LSP diagnostics.
148
294
  *
@@ -1,6 +1,43 @@
1
1
  import { type FormSpecAnalysisDiagnostic, type FormSpecSerializedCompletionContext, type FormSpecSerializedHoverInfo } from "@formspec/analysis/protocol";
2
+ /**
3
+ * Converts a `file://` URI to an absolute filesystem path.
4
+ *
5
+ * Returns `null` for any URI that is not a valid `file://` URI (e.g. `untitled:`, `vscode-notebook-cell:`,
6
+ * malformed URIs). On Windows the returned path uses backslash separators as produced by
7
+ * `url.fileURLToPath`.
8
+ *
9
+ * @public
10
+ */
2
11
  export declare function fileUriToPathOrNull(uri: string): string | null;
12
+ /**
13
+ * Queries the FormSpec TypeScript plugin for semantic completion context at `offset` in the
14
+ * document identified by `filePath`.
15
+ *
16
+ * The workspace root containing `filePath` is located automatically from `workspaceRoots`. The
17
+ * plugin manifest is read from disk on each call. Returns `null` when no matching workspace root
18
+ * is found, the manifest is missing or invalid, the IPC socket is unavailable, the plugin times
19
+ * out (default 2 s), or the plugin's response was computed against a different version of the
20
+ * document than `documentText` (stale response guard).
21
+ *
22
+ * Pass the result to {@link getCompletionItemsAtOffset} as `semanticContext`.
23
+ *
24
+ * @public
25
+ */
3
26
  export declare function getPluginCompletionContextForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, offset: number, timeoutMs?: number): Promise<FormSpecSerializedCompletionContext | null>;
27
+ /**
28
+ * Queries the FormSpec TypeScript plugin for semantic hover information at `offset` in the
29
+ * document identified by `filePath`.
30
+ *
31
+ * The workspace root containing `filePath` is located automatically from `workspaceRoots`. The
32
+ * plugin manifest is read from disk on each call. Returns `null` when no matching workspace root
33
+ * is found, the manifest is missing or invalid, the IPC socket is unavailable, the plugin times
34
+ * out (default 2 s), or the plugin's response was computed against a different version of the
35
+ * document than `documentText` (stale response guard).
36
+ *
37
+ * Pass the result to {@link getHoverAtOffset} as `semanticHover`.
38
+ *
39
+ * @public
40
+ */
4
41
  export declare function getPluginHoverForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, offset: number, timeoutMs?: number): Promise<FormSpecSerializedHoverInfo | null>;
5
42
  /**
6
43
  * Retrieves canonical FormSpec diagnostics for the current document revision
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-client.d.ts","sourceRoot":"","sources":["../src/plugin-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,0BAA0B,EAE/B,KAAK,mCAAmC,EACxC,KAAK,2BAA2B,EAGjC,MAAM,6BAA6B,CAAC;AAyGrC,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM9D;AAqBD,wBAAsB,qCAAqC,CACzD,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,SAAkC,GAC1C,OAAO,CAAC,mCAAmC,GAAG,IAAI,CAAC,CAiBrD;AAED,wBAAsB,yBAAyB,CAC7C,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,SAAkC,GAC1C,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC,CAiB7C;AAED;;;;;;GAMG;AACH,wBAAsB,+BAA+B,CACnD,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,SAAS,SAAkC,GAC1C,OAAO,CAAC,SAAS,0BAA0B,EAAE,GAAG,IAAI,CAAC,CAkBvD"}
1
+ {"version":3,"file":"plugin-client.d.ts","sourceRoot":"","sources":["../src/plugin-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,0BAA0B,EAE/B,KAAK,mCAAmC,EACxC,KAAK,2BAA2B,EAGjC,MAAM,6BAA6B,CAAC;AAyGrC;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM9D;AAqBD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,qCAAqC,CACzD,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,SAAkC,GAC1C,OAAO,CAAC,mCAAmC,GAAG,IAAI,CAAC,CAiBrD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,yBAAyB,CAC7C,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,SAAkC,GAC1C,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC,CAiB7C;AAED;;;;;;GAMG;AACH,wBAAsB,+BAA+B,CACnD,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,SAAS,SAAkC,GAC1C,OAAO,CAAC,SAAS,0BAA0B,EAAE,GAAG,IAAI,CAAC,CAkBvD"}
@@ -13,6 +13,14 @@ import { CompletionItem } from "vscode-languageserver/node.js";
13
13
  * @public
14
14
  */
15
15
  export declare function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[];
16
- /** @internal */
16
+ /**
17
+ * Returns completion items for the cursor position at `offset` in `documentText`.
18
+ *
19
+ * When `semanticContext` is supplied (e.g. from {@link getPluginCompletionContextForDocument}),
20
+ * it is used directly to produce target-value or tag-name completions. Pass `null` or omit it
21
+ * to fall back to syntax-only analysis, which works without the TypeScript plugin.
22
+ *
23
+ * @public
24
+ */
17
25
  export declare function getCompletionItemsAtOffset(documentText: string, offset: number, extensions?: readonly ExtensionDefinition[], semanticContext?: FormSpecSerializedCompletionContext | null): CompletionItem[];
18
26
  //# sourceMappingURL=completion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/providers/completion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,mCAAmC,EAKzC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAsB,MAAM,+BAA+B,CAAC;AAEnF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,SAAS,mBAAmB,EAAE,GAAG,cAAc,EAAE,CAMhG;AAkCD,gBAAgB;AAChB,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,SAAS,mBAAmB,EAAE,EAC3C,eAAe,CAAC,EAAE,mCAAmC,GAAG,IAAI,GAC3D,cAAc,EAAE,CAkClB"}
1
+ {"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/providers/completion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,mCAAmC,EAKzC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAsB,MAAM,+BAA+B,CAAC;AAEnF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,SAAS,mBAAmB,EAAE,GAAG,cAAc,EAAE,CAMhG;AAkCD;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,SAAS,mBAAmB,EAAE,EAC3C,eAAe,CAAC,EAAE,mCAAmC,GAAG,IAAI,GAC3D,cAAc,EAAE,CAkClB"}
@@ -13,6 +13,15 @@ import type { Hover } from "vscode-languageserver/node.js";
13
13
  * @public
14
14
  */
15
15
  export declare function getHoverForTag(tagName: string, extensions?: readonly ExtensionDefinition[]): Hover | null;
16
- /** @internal */
16
+ /**
17
+ * Returns LSP hover content for the cursor position at `offset` in `documentText`.
18
+ *
19
+ * When `semanticHover` is supplied (e.g. from {@link getPluginHoverForDocument}), it is used
20
+ * directly as the hover source. Pass `null` or omit it to fall back to syntax-only analysis,
21
+ * which works without the TypeScript plugin. Returns `null` when the cursor is not over a
22
+ * recognised FormSpec tag.
23
+ *
24
+ * @public
25
+ */
17
26
  export declare function getHoverAtOffset(documentText: string, offset: number, extensions?: readonly ExtensionDefinition[], semanticHover?: FormSpecSerializedHoverInfo | null): Hover | null;
18
27
  //# sourceMappingURL=hover.d.ts.map