@formspec/language-server 0.1.0-alpha.25 → 0.1.0-alpha.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -7
- package/dist/index.js.map +1 -1
- package/dist/language-server-alpha.d.ts +22 -134
- package/dist/language-server-beta.d.ts +22 -134
- package/dist/language-server-internal.d.ts +22 -134
- package/dist/language-server.d.ts +22 -134
- package/dist/plugin-client.d.ts +2 -2
- package/dist/plugin-client.d.ts.map +1 -1
- package/dist/providers/completion.d.ts +1 -1
- package/dist/providers/hover.d.ts +1 -1
- package/package.json +3 -3
|
@@ -32,13 +32,23 @@ import type { Hover } from 'vscode-languageserver/node.js';
|
|
|
32
32
|
import type { Location } from 'vscode-languageserver/node.js';
|
|
33
33
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
34
34
|
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Half-open character span within a source comment string.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
36
40
|
export declare interface CommentSourceSpan {
|
|
41
|
+
/** Zero-based start offset, inclusive. */
|
|
37
42
|
readonly start: number;
|
|
43
|
+
/** Zero-based end offset, exclusive. */
|
|
38
44
|
readonly end: number;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Source span used by serialized comment-analysis payloads.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
42
52
|
export declare type CommentSpan = CommentSourceSpan;
|
|
43
53
|
|
|
44
54
|
/**
|
|
@@ -89,12 +99,19 @@ export declare function fileUriToPathOrNull(uri: string): string | null;
|
|
|
89
99
|
* @public
|
|
90
100
|
*/
|
|
91
101
|
export declare interface FormSpecAnalysisDiagnostic {
|
|
102
|
+
/** Stable diagnostic code for downstream rendering or filtering. */
|
|
92
103
|
readonly code: string;
|
|
104
|
+
/** High-level diagnostic category. */
|
|
93
105
|
readonly category: FormSpecAnalysisDiagnosticCategory;
|
|
106
|
+
/** Human-readable diagnostic message. */
|
|
94
107
|
readonly message: string;
|
|
108
|
+
/** Source range where the diagnostic applies. */
|
|
95
109
|
readonly range: CommentSpan;
|
|
110
|
+
/** Severity to surface in editor or CLI UIs. */
|
|
96
111
|
readonly severity: "error" | "warning" | "info";
|
|
112
|
+
/** Additional source locations related to the diagnostic. */
|
|
97
113
|
readonly relatedLocations: readonly FormSpecAnalysisDiagnosticLocation[];
|
|
114
|
+
/** Structured diagnostic facts for white-label downstream formatting. */
|
|
98
115
|
readonly data: Record<string, FormSpecAnalysisDiagnosticDataValue>;
|
|
99
116
|
}
|
|
100
117
|
|
|
@@ -119,88 +136,14 @@ export declare type FormSpecAnalysisDiagnosticDataValue = string | number | bool
|
|
|
119
136
|
* @public
|
|
120
137
|
*/
|
|
121
138
|
export declare interface FormSpecAnalysisDiagnosticLocation {
|
|
139
|
+
/** Absolute file path for the related diagnostic location. */
|
|
122
140
|
readonly filePath: string;
|
|
141
|
+
/** Source range for the related diagnostic location. */
|
|
123
142
|
readonly range: CommentSpan;
|
|
143
|
+
/** Optional explanatory text for the related location. */
|
|
124
144
|
readonly message?: string;
|
|
125
145
|
}
|
|
126
146
|
|
|
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
147
|
/**
|
|
205
148
|
* Returns the full set of tag-name completions currently known to FormSpec.
|
|
206
149
|
*
|
|
@@ -208,17 +151,6 @@ declare type FormSpecTargetKind = "none" | "path" | "member" | "variant";
|
|
|
208
151
|
*/
|
|
209
152
|
export declare function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[];
|
|
210
153
|
|
|
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
154
|
/**
|
|
223
155
|
* Returns the definition location for a symbol at the given position.
|
|
224
156
|
*
|
|
@@ -229,18 +161,6 @@ export declare function getCompletionItemsAtOffset(documentText: string, offset:
|
|
|
229
161
|
*/
|
|
230
162
|
export declare function getDefinition(): Location | null;
|
|
231
163
|
|
|
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
164
|
/**
|
|
245
165
|
* Returns hover content for a single FormSpec tag name.
|
|
246
166
|
*
|
|
@@ -248,22 +168,6 @@ export declare function getHoverAtOffset(documentText: string, offset: number, e
|
|
|
248
168
|
*/
|
|
249
169
|
export declare function getHoverForTag(tagName: string, extensions?: readonly ExtensionDefinition[]): Hover | null;
|
|
250
170
|
|
|
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
171
|
/**
|
|
268
172
|
* Retrieves canonical FormSpec diagnostics for the current document revision
|
|
269
173
|
* from the plugin transport. Returns `null` when the transport is missing,
|
|
@@ -273,22 +177,6 @@ export declare function getPluginCompletionContextForDocument(workspaceRoots: re
|
|
|
273
177
|
*/
|
|
274
178
|
export declare function getPluginDiagnosticsForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, timeoutMs?: number): Promise<readonly FormSpecAnalysisDiagnostic[] | null>;
|
|
275
179
|
|
|
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
180
|
/**
|
|
293
181
|
* Converts canonical FormSpec diagnostics into LSP diagnostics.
|
|
294
182
|
*
|
|
@@ -32,13 +32,23 @@ import type { Hover } from 'vscode-languageserver/node.js';
|
|
|
32
32
|
import type { Location } from 'vscode-languageserver/node.js';
|
|
33
33
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
34
34
|
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Half-open character span within a source comment string.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
36
40
|
export declare interface CommentSourceSpan {
|
|
41
|
+
/** Zero-based start offset, inclusive. */
|
|
37
42
|
readonly start: number;
|
|
43
|
+
/** Zero-based end offset, exclusive. */
|
|
38
44
|
readonly end: number;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Source span used by serialized comment-analysis payloads.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
42
52
|
export declare type CommentSpan = CommentSourceSpan;
|
|
43
53
|
|
|
44
54
|
/**
|
|
@@ -89,12 +99,19 @@ export declare function fileUriToPathOrNull(uri: string): string | null;
|
|
|
89
99
|
* @public
|
|
90
100
|
*/
|
|
91
101
|
export declare interface FormSpecAnalysisDiagnostic {
|
|
102
|
+
/** Stable diagnostic code for downstream rendering or filtering. */
|
|
92
103
|
readonly code: string;
|
|
104
|
+
/** High-level diagnostic category. */
|
|
93
105
|
readonly category: FormSpecAnalysisDiagnosticCategory;
|
|
106
|
+
/** Human-readable diagnostic message. */
|
|
94
107
|
readonly message: string;
|
|
108
|
+
/** Source range where the diagnostic applies. */
|
|
95
109
|
readonly range: CommentSpan;
|
|
110
|
+
/** Severity to surface in editor or CLI UIs. */
|
|
96
111
|
readonly severity: "error" | "warning" | "info";
|
|
112
|
+
/** Additional source locations related to the diagnostic. */
|
|
97
113
|
readonly relatedLocations: readonly FormSpecAnalysisDiagnosticLocation[];
|
|
114
|
+
/** Structured diagnostic facts for white-label downstream formatting. */
|
|
98
115
|
readonly data: Record<string, FormSpecAnalysisDiagnosticDataValue>;
|
|
99
116
|
}
|
|
100
117
|
|
|
@@ -119,88 +136,14 @@ export declare type FormSpecAnalysisDiagnosticDataValue = string | number | bool
|
|
|
119
136
|
* @public
|
|
120
137
|
*/
|
|
121
138
|
export declare interface FormSpecAnalysisDiagnosticLocation {
|
|
139
|
+
/** Absolute file path for the related diagnostic location. */
|
|
122
140
|
readonly filePath: string;
|
|
141
|
+
/** Source range for the related diagnostic location. */
|
|
123
142
|
readonly range: CommentSpan;
|
|
143
|
+
/** Optional explanatory text for the related location. */
|
|
124
144
|
readonly message?: string;
|
|
125
145
|
}
|
|
126
146
|
|
|
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
147
|
/**
|
|
205
148
|
* Returns the full set of tag-name completions currently known to FormSpec.
|
|
206
149
|
*
|
|
@@ -208,17 +151,6 @@ declare type FormSpecTargetKind = "none" | "path" | "member" | "variant";
|
|
|
208
151
|
*/
|
|
209
152
|
export declare function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[];
|
|
210
153
|
|
|
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
154
|
/**
|
|
223
155
|
* Returns the definition location for a symbol at the given position.
|
|
224
156
|
*
|
|
@@ -229,18 +161,6 @@ export declare function getCompletionItemsAtOffset(documentText: string, offset:
|
|
|
229
161
|
*/
|
|
230
162
|
export declare function getDefinition(): Location | null;
|
|
231
163
|
|
|
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
164
|
/**
|
|
245
165
|
* Returns hover content for a single FormSpec tag name.
|
|
246
166
|
*
|
|
@@ -248,22 +168,6 @@ export declare function getHoverAtOffset(documentText: string, offset: number, e
|
|
|
248
168
|
*/
|
|
249
169
|
export declare function getHoverForTag(tagName: string, extensions?: readonly ExtensionDefinition[]): Hover | null;
|
|
250
170
|
|
|
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
171
|
/**
|
|
268
172
|
* Retrieves canonical FormSpec diagnostics for the current document revision
|
|
269
173
|
* from the plugin transport. Returns `null` when the transport is missing,
|
|
@@ -273,22 +177,6 @@ export declare function getPluginCompletionContextForDocument(workspaceRoots: re
|
|
|
273
177
|
*/
|
|
274
178
|
export declare function getPluginDiagnosticsForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, timeoutMs?: number): Promise<readonly FormSpecAnalysisDiagnostic[] | null>;
|
|
275
179
|
|
|
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
180
|
/**
|
|
293
181
|
* Converts canonical FormSpec diagnostics into LSP diagnostics.
|
|
294
182
|
*
|
|
@@ -32,13 +32,23 @@ import type { Hover } from 'vscode-languageserver/node.js';
|
|
|
32
32
|
import type { Location } from 'vscode-languageserver/node.js';
|
|
33
33
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
34
34
|
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Half-open character span within a source comment string.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
36
40
|
export declare interface CommentSourceSpan {
|
|
41
|
+
/** Zero-based start offset, inclusive. */
|
|
37
42
|
readonly start: number;
|
|
43
|
+
/** Zero-based end offset, exclusive. */
|
|
38
44
|
readonly end: number;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Source span used by serialized comment-analysis payloads.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
42
52
|
export declare type CommentSpan = CommentSourceSpan;
|
|
43
53
|
|
|
44
54
|
/**
|
|
@@ -89,12 +99,19 @@ export declare function fileUriToPathOrNull(uri: string): string | null;
|
|
|
89
99
|
* @public
|
|
90
100
|
*/
|
|
91
101
|
export declare interface FormSpecAnalysisDiagnostic {
|
|
102
|
+
/** Stable diagnostic code for downstream rendering or filtering. */
|
|
92
103
|
readonly code: string;
|
|
104
|
+
/** High-level diagnostic category. */
|
|
93
105
|
readonly category: FormSpecAnalysisDiagnosticCategory;
|
|
106
|
+
/** Human-readable diagnostic message. */
|
|
94
107
|
readonly message: string;
|
|
108
|
+
/** Source range where the diagnostic applies. */
|
|
95
109
|
readonly range: CommentSpan;
|
|
110
|
+
/** Severity to surface in editor or CLI UIs. */
|
|
96
111
|
readonly severity: "error" | "warning" | "info";
|
|
112
|
+
/** Additional source locations related to the diagnostic. */
|
|
97
113
|
readonly relatedLocations: readonly FormSpecAnalysisDiagnosticLocation[];
|
|
114
|
+
/** Structured diagnostic facts for white-label downstream formatting. */
|
|
98
115
|
readonly data: Record<string, FormSpecAnalysisDiagnosticDataValue>;
|
|
99
116
|
}
|
|
100
117
|
|
|
@@ -119,88 +136,14 @@ export declare type FormSpecAnalysisDiagnosticDataValue = string | number | bool
|
|
|
119
136
|
* @public
|
|
120
137
|
*/
|
|
121
138
|
export declare interface FormSpecAnalysisDiagnosticLocation {
|
|
139
|
+
/** Absolute file path for the related diagnostic location. */
|
|
122
140
|
readonly filePath: string;
|
|
141
|
+
/** Source range for the related diagnostic location. */
|
|
123
142
|
readonly range: CommentSpan;
|
|
143
|
+
/** Optional explanatory text for the related location. */
|
|
124
144
|
readonly message?: string;
|
|
125
145
|
}
|
|
126
146
|
|
|
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
147
|
/**
|
|
205
148
|
* Returns the full set of tag-name completions currently known to FormSpec.
|
|
206
149
|
*
|
|
@@ -208,17 +151,6 @@ declare type FormSpecTargetKind = "none" | "path" | "member" | "variant";
|
|
|
208
151
|
*/
|
|
209
152
|
export declare function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[];
|
|
210
153
|
|
|
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
154
|
/**
|
|
223
155
|
* Returns the definition location for a symbol at the given position.
|
|
224
156
|
*
|
|
@@ -229,18 +161,6 @@ export declare function getCompletionItemsAtOffset(documentText: string, offset:
|
|
|
229
161
|
*/
|
|
230
162
|
export declare function getDefinition(): Location | null;
|
|
231
163
|
|
|
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
164
|
/**
|
|
245
165
|
* Returns hover content for a single FormSpec tag name.
|
|
246
166
|
*
|
|
@@ -248,22 +168,6 @@ export declare function getHoverAtOffset(documentText: string, offset: number, e
|
|
|
248
168
|
*/
|
|
249
169
|
export declare function getHoverForTag(tagName: string, extensions?: readonly ExtensionDefinition[]): Hover | null;
|
|
250
170
|
|
|
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
171
|
/**
|
|
268
172
|
* Retrieves canonical FormSpec diagnostics for the current document revision
|
|
269
173
|
* from the plugin transport. Returns `null` when the transport is missing,
|
|
@@ -273,22 +177,6 @@ export declare function getPluginCompletionContextForDocument(workspaceRoots: re
|
|
|
273
177
|
*/
|
|
274
178
|
export declare function getPluginDiagnosticsForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, timeoutMs?: number): Promise<readonly FormSpecAnalysisDiagnostic[] | null>;
|
|
275
179
|
|
|
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
180
|
/**
|
|
293
181
|
* Converts canonical FormSpec diagnostics into LSP diagnostics.
|
|
294
182
|
*
|