@formspec/language-server 0.1.0-alpha.19 → 0.1.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/plugin-client.test.d.ts +2 -0
- package/dist/__tests__/plugin-client.test.d.ts.map +1 -0
- package/dist/index.cjs +263 -232
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +265 -235
- package/dist/index.js.map +1 -1
- package/dist/language-server.d.ts +21 -19
- package/dist/plugin-client.d.ts +5 -0
- package/dist/plugin-client.d.ts.map +1 -0
- package/dist/providers/completion.d.ts +8 -13
- package/dist/providers/completion.d.ts.map +1 -1
- package/dist/providers/definition.d.ts +1 -0
- package/dist/providers/definition.d.ts.map +1 -1
- package/dist/providers/hover.d.ts +9 -12
- package/dist/providers/hover.d.ts.map +1 -1
- package/dist/server.d.ts +12 -0
- package/dist/server.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* `@Maximum`, `@Pattern`, etc.) in TypeScript files.
|
|
7
7
|
*
|
|
8
8
|
* This package implements the Language Server Protocol (LSP) using the
|
|
9
|
-
* `vscode-languageserver` library.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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
12
|
*
|
|
13
13
|
* Diagnostics are intentionally omitted per design decision A7.
|
|
14
14
|
*
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
import { CompletionItem } from 'vscode-languageserver/node.js';
|
|
27
27
|
import { Connection } from 'vscode-languageserver/node.js';
|
|
28
|
-
import { ExtensionDefinition } from '@formspec/core';
|
|
28
|
+
import type { ExtensionDefinition } from '@formspec/core';
|
|
29
29
|
import type { Hover } from 'vscode-languageserver/node.js';
|
|
30
30
|
import type { Location } from 'vscode-languageserver/node.js';
|
|
31
31
|
|
|
@@ -36,24 +36,30 @@ import type { Location } from 'vscode-languageserver/node.js';
|
|
|
36
36
|
* Call `connection.listen()` to start accepting messages.
|
|
37
37
|
*
|
|
38
38
|
* @returns The configured LSP connection (not yet listening)
|
|
39
|
+
* @public
|
|
39
40
|
*/
|
|
40
41
|
export declare function createServer(options?: CreateServerOptions): Connection;
|
|
41
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Public configuration for constructing the FormSpec language server.
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
42
48
|
export declare interface CreateServerOptions {
|
|
43
49
|
/** Optional extension definitions whose custom tags should be surfaced by tooling. */
|
|
44
50
|
readonly extensions?: readonly ExtensionDefinition[];
|
|
51
|
+
/** Optional workspace roots to use before initialize() provides them. */
|
|
52
|
+
readonly workspaceRoots?: readonly string[];
|
|
53
|
+
/** Set to false to disable tsserver-plugin semantic enrichment. */
|
|
54
|
+
readonly usePluginTransport?: boolean;
|
|
55
|
+
/** IPC timeout, in milliseconds, for semantic plugin requests. */
|
|
56
|
+
readonly pluginQueryTimeoutMs?: number;
|
|
45
57
|
}
|
|
46
58
|
|
|
47
59
|
/**
|
|
48
|
-
* Returns
|
|
60
|
+
* Returns the full set of tag-name completions currently known to FormSpec.
|
|
49
61
|
*
|
|
50
|
-
*
|
|
51
|
-
* stays in sync with the single source of truth in `@formspec/core`.
|
|
52
|
-
*
|
|
53
|
-
* Each item uses `CompletionItemKind.Keyword` since these are annotation
|
|
54
|
-
* tags used within JSDoc comments rather than language symbols.
|
|
55
|
-
*
|
|
56
|
-
* @returns An array of LSP completion items for FormSpec constraint tags
|
|
62
|
+
* @public
|
|
57
63
|
*/
|
|
58
64
|
export declare function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[];
|
|
59
65
|
|
|
@@ -63,18 +69,14 @@ export declare function getCompletionItems(extensions?: readonly ExtensionDefini
|
|
|
63
69
|
* Always returns `null` in this stub implementation.
|
|
64
70
|
*
|
|
65
71
|
* @returns `null` — not yet implemented
|
|
72
|
+
* @public
|
|
66
73
|
*/
|
|
67
74
|
export declare function getDefinition(): Location | null;
|
|
68
75
|
|
|
69
76
|
/**
|
|
70
|
-
* Returns hover
|
|
71
|
-
*
|
|
72
|
-
* Accepts both camelCase (`"minimum"`) and PascalCase (`"Minimum"`) forms.
|
|
73
|
-
* The `@` prefix is stripped before lookup if present.
|
|
74
|
-
* Returns `null` when the tag is not a recognized FormSpec constraint tag.
|
|
77
|
+
* Returns hover content for a single FormSpec tag name.
|
|
75
78
|
*
|
|
76
|
-
* @
|
|
77
|
-
* @returns An LSP `Hover` response, or `null` if the tag is not recognized
|
|
79
|
+
* @public
|
|
78
80
|
*/
|
|
79
81
|
export declare function getHoverForTag(tagName: string, extensions?: readonly ExtensionDefinition[]): Hover | null;
|
|
80
82
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type FormSpecSerializedCompletionContext, type FormSpecSerializedHoverInfo } from "@formspec/analysis";
|
|
2
|
+
export declare function fileUriToPathOrNull(uri: string): string | null;
|
|
3
|
+
export declare function getPluginCompletionContextForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, offset: number, timeoutMs?: number): Promise<FormSpecSerializedCompletionContext | null>;
|
|
4
|
+
export declare function getPluginHoverForDocument(workspaceRoots: readonly string[], filePath: string, documentText: string, offset: number, timeoutMs?: number): Promise<FormSpecSerializedHoverInfo | null>;
|
|
5
|
+
//# sourceMappingURL=plugin-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-client.d.ts","sourceRoot":"","sources":["../src/plugin-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAOL,KAAK,mCAAmC,EACxC,KAAK,2BAA2B,EAGjC,MAAM,oBAAoB,CAAC;AAwG5B,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"}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Completion provider for FormSpec JSDoc constraint tags.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `BUILTIN_CONSTRAINT_DEFINITIONS`. This is a skeleton — context-aware
|
|
7
|
-
* filtering will be added in a future phase.
|
|
4
|
+
* Uses the shared tag registry from `@formspec/analysis` so completions stay
|
|
5
|
+
* aligned with the same metadata that powers linting and build-time analysis.
|
|
8
6
|
*/
|
|
9
|
-
import { type
|
|
7
|
+
import { type FormSpecSerializedCompletionContext } from "@formspec/analysis";
|
|
8
|
+
import type { ExtensionDefinition } from "@formspec/core";
|
|
10
9
|
import { CompletionItem } from "vscode-languageserver/node.js";
|
|
11
10
|
/**
|
|
12
|
-
* Returns
|
|
11
|
+
* Returns the full set of tag-name completions currently known to FormSpec.
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
* stays in sync with the single source of truth in `@formspec/core`.
|
|
16
|
-
*
|
|
17
|
-
* Each item uses `CompletionItemKind.Keyword` since these are annotation
|
|
18
|
-
* tags used within JSDoc comments rather than language symbols.
|
|
19
|
-
*
|
|
20
|
-
* @returns An array of LSP completion items for FormSpec constraint tags
|
|
13
|
+
* @public
|
|
21
14
|
*/
|
|
22
15
|
export declare function getCompletionItems(extensions?: readonly ExtensionDefinition[]): CompletionItem[];
|
|
16
|
+
/** @internal */
|
|
17
|
+
export declare function getCompletionItemsAtOffset(documentText: string, offset: number, extensions?: readonly ExtensionDefinition[], semanticContext?: FormSpecSerializedCompletionContext | null): CompletionItem[];
|
|
23
18
|
//# sourceMappingURL=completion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/providers/completion.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/providers/completion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,mCAAmC,EAKzC,MAAM,oBAAoB,CAAC;AAC5B,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;AAUD,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,CAgDlB"}
|
|
@@ -12,6 +12,7 @@ import type { Location } from "vscode-languageserver/node.js";
|
|
|
12
12
|
* Always returns `null` in this stub implementation.
|
|
13
13
|
*
|
|
14
14
|
* @returns `null` — not yet implemented
|
|
15
|
+
* @public
|
|
15
16
|
*/
|
|
16
17
|
export declare function getDefinition(): Location | null;
|
|
17
18
|
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/providers/definition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/providers/definition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,QAAQ,GAAG,IAAI,CAE/C"}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hover provider for FormSpec JSDoc
|
|
2
|
+
* Hover provider for FormSpec JSDoc tags.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* the
|
|
6
|
-
* detection within JSDoc comment ranges will be added in a future phase.
|
|
4
|
+
* Uses the shared registry from `@formspec/analysis` so hover content stays in
|
|
5
|
+
* sync with the tag inventory and overload metadata.
|
|
7
6
|
*/
|
|
8
|
-
import { type
|
|
7
|
+
import { type FormSpecSerializedHoverInfo } from "@formspec/analysis";
|
|
8
|
+
import type { ExtensionDefinition } from "@formspec/core";
|
|
9
9
|
import type { Hover } from "vscode-languageserver/node.js";
|
|
10
10
|
/**
|
|
11
|
-
* Returns hover
|
|
11
|
+
* Returns hover content for a single FormSpec tag name.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
* The `@` prefix is stripped before lookup if present.
|
|
15
|
-
* Returns `null` when the tag is not a recognized FormSpec constraint tag.
|
|
16
|
-
*
|
|
17
|
-
* @param tagName - The tag name to look up (e.g., `"minimum"`, `"@pattern"`)
|
|
18
|
-
* @returns An LSP `Hover` response, or `null` if the tag is not recognized
|
|
13
|
+
* @public
|
|
19
14
|
*/
|
|
20
15
|
export declare function getHoverForTag(tagName: string, extensions?: readonly ExtensionDefinition[]): Hover | null;
|
|
16
|
+
/** @internal */
|
|
17
|
+
export declare function getHoverAtOffset(documentText: string, offset: number, extensions?: readonly ExtensionDefinition[], semanticHover?: FormSpecSerializedHoverInfo | null): Hover | null;
|
|
21
18
|
//# sourceMappingURL=hover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../src/providers/hover.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../src/providers/hover.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,2BAA2B,EAIjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,SAAS,mBAAmB,EAAE,GAC1C,KAAK,GAAG,IAAI,CAad;AAED,gBAAgB;AAChB,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,SAAS,mBAAmB,EAAE,EAC3C,aAAa,CAAC,EAAE,2BAA2B,GAAG,IAAI,GACjD,KAAK,GAAG,IAAI,CAcd"}
|
package/dist/server.d.ts
CHANGED
|
@@ -10,9 +10,20 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { type Connection } from "vscode-languageserver/node.js";
|
|
12
12
|
import type { ExtensionDefinition } from "@formspec/core";
|
|
13
|
+
/**
|
|
14
|
+
* Public configuration for constructing the FormSpec language server.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
13
18
|
export interface CreateServerOptions {
|
|
14
19
|
/** Optional extension definitions whose custom tags should be surfaced by tooling. */
|
|
15
20
|
readonly extensions?: readonly ExtensionDefinition[];
|
|
21
|
+
/** Optional workspace roots to use before initialize() provides them. */
|
|
22
|
+
readonly workspaceRoots?: readonly string[];
|
|
23
|
+
/** Set to false to disable tsserver-plugin semantic enrichment. */
|
|
24
|
+
readonly usePluginTransport?: boolean;
|
|
25
|
+
/** IPC timeout, in milliseconds, for semantic plugin requests. */
|
|
26
|
+
readonly pluginQueryTimeoutMs?: number;
|
|
16
27
|
}
|
|
17
28
|
/**
|
|
18
29
|
* Creates and configures the FormSpec language server connection.
|
|
@@ -21,6 +32,7 @@ export interface CreateServerOptions {
|
|
|
21
32
|
* Call `connection.listen()` to start accepting messages.
|
|
22
33
|
*
|
|
23
34
|
* @returns The configured LSP connection (not yet listening)
|
|
35
|
+
* @public
|
|
24
36
|
*/
|
|
25
37
|
export declare function createServer(options?: CreateServerOptions): Connection;
|
|
26
38
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAKL,KAAK,UAAU,EAEhB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAqC1D;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,sFAAsF;IACtF,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACrD,yEAAyE;IACzE,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,mEAAmE;IACnE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACtC,kEAAkE;IAClE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,UAAU,CAkF1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formspec/language-server",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.20",
|
|
4
4
|
"description": "Language server for FormSpec — completions, hover, and go-to-definition for JSDoc constraint tags",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"vscode-languageserver": "^9.0.1",
|
|
22
22
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
23
|
+
"@formspec/analysis": "0.1.0-alpha.20",
|
|
23
24
|
"@formspec/core": "0.1.0-alpha.19"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|