@nudojs/lsp 0.8.0 → 1.1.0
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/README.md +5 -3
- package/dist/index.d.ts +101 -0
- package/dist/index.js +250754 -0
- package/dist/public-api.d.ts +45 -0
- package/dist/public-api.js +82 -0
- package/dist/server.d.ts +14 -6
- package/dist/server.js +76406 -90125
- package/package.json +23 -9
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Freeze inventory for `@nudojs/lsp` public surface (A1/A7).
|
|
3
|
+
*
|
|
4
|
+
* Pure constants — importable without starting the language server
|
|
5
|
+
* (`server.ts` has side effects on import). Human-readable inventory:
|
|
6
|
+
* `packages/lsp/PUBLIC_API.md`.
|
|
7
|
+
*
|
|
8
|
+
* Protocol contract:
|
|
9
|
+
* - executeCommand uses **dot** form: `nudo.check`
|
|
10
|
+
* - custom requests use **slash** form: `nudo/check` (canonical protocol)
|
|
11
|
+
* - every slash-form agent request has a matching executeCommand name
|
|
12
|
+
*
|
|
13
|
+
* Product names match CLI verbs (design-cli-semantics): check / test /
|
|
14
|
+
* contract / export / health. There are no protocol aliases.
|
|
15
|
+
*/
|
|
16
|
+
/** workspace/executeCommand names (dot form) — declared on initialize */
|
|
17
|
+
declare const NUDO_EXECUTE_COMMANDS: readonly ["nudo.whatIf", "nudo.suggestCase", "nudo.trace", "nudo.check", "nudo.hover", "nudo.test", "nudo.contract", "nudo.contract.draft", "nudo.contract.emit", "nudo.selectCase", "nudo.getActiveCases"];
|
|
18
|
+
/**
|
|
19
|
+
* Custom LSP request method names (slash form) — the protocol contract.
|
|
20
|
+
* Agent tools also register the dot-form method for MCP bridges.
|
|
21
|
+
*/
|
|
22
|
+
declare const NUDO_SLASH_REQUESTS: readonly ["nudo/selectCase", "nudo/getActiveCases", "nudo/whatIf", "nudo/suggestCase", "nudo/trace", "nudo/check", "nudo/hover", "nudo/test", "nudo/contract", "nudo/contract.draft", "nudo/contract.emit"];
|
|
23
|
+
/**
|
|
24
|
+
* Agent-tool names shared by executeCommand / slash requests / AGENT_TOOL_SOURCES.
|
|
25
|
+
* `codeLens` is server-computed only (no command/request); `selectCase` /
|
|
26
|
+
* `getActiveCases` are editor commands, not agent tools.
|
|
27
|
+
*/
|
|
28
|
+
declare const NUDO_AGENT_TOOL_NAMES: readonly ["whatIf", "suggestCase", "trace", "check", "hover", "test", "contract", "contract.draft", "contract.emit"];
|
|
29
|
+
/** Capability keys declared in connection.onInitialize */
|
|
30
|
+
declare const NUDO_INITIALIZE_CAPABILITIES: readonly ["textDocumentSync", "hoverProvider", "completionProvider", "codeLensProvider", "inlayHintProvider", "definitionProvider", "referencesProvider", "renameProvider", "documentSymbolProvider", "workspaceSymbolProvider", "codeActionProvider", "signatureHelpProvider", "semanticTokensProvider", "executeCommandProvider", "diagnosticProvider"];
|
|
31
|
+
/** Slash-form → matching executeCommand (dot form) */
|
|
32
|
+
declare function slashToExecuteCommand(slash: string): string;
|
|
33
|
+
/** npm package public surface (mirrors packages/lsp/package.json) */
|
|
34
|
+
declare const NUDO_LSP_PACKAGE_SURFACE: {
|
|
35
|
+
readonly name: "@nudojs/lsp";
|
|
36
|
+
readonly bin: "nudo-lsp";
|
|
37
|
+
readonly entry: ".";
|
|
38
|
+
readonly entryPath: "./dist/server.js";
|
|
39
|
+
readonly files: readonly ["dist"];
|
|
40
|
+
/** Machine-readable freeze inventory (no server side effects). */
|
|
41
|
+
readonly publicApiExport: "./public-api";
|
|
42
|
+
readonly publicApiPath: "./dist/public-api.js";
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { NUDO_AGENT_TOOL_NAMES, NUDO_EXECUTE_COMMANDS, NUDO_INITIALIZE_CAPABILITIES, NUDO_LSP_PACKAGE_SURFACE, NUDO_SLASH_REQUESTS, slashToExecuteCommand };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createRequire as __nudoCreateRequire } from "module";
|
|
2
|
+
import { fileURLToPath as __nudoFileURLToPath } from "url";
|
|
3
|
+
const require = __nudoCreateRequire(import.meta.url);
|
|
4
|
+
const __filename = __nudoFileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = __nudoFileURLToPath(new URL(".", import.meta.url));
|
|
6
|
+
|
|
7
|
+
// src/public-api.ts
|
|
8
|
+
var NUDO_EXECUTE_COMMANDS = [
|
|
9
|
+
"nudo.whatIf",
|
|
10
|
+
"nudo.suggestCase",
|
|
11
|
+
"nudo.trace",
|
|
12
|
+
"nudo.check",
|
|
13
|
+
"nudo.hover",
|
|
14
|
+
"nudo.test",
|
|
15
|
+
"nudo.contract",
|
|
16
|
+
"nudo.contract.draft",
|
|
17
|
+
"nudo.contract.emit",
|
|
18
|
+
"nudo.selectCase",
|
|
19
|
+
"nudo.getActiveCases"
|
|
20
|
+
];
|
|
21
|
+
var NUDO_SLASH_REQUESTS = [
|
|
22
|
+
"nudo/selectCase",
|
|
23
|
+
"nudo/getActiveCases",
|
|
24
|
+
"nudo/whatIf",
|
|
25
|
+
"nudo/suggestCase",
|
|
26
|
+
"nudo/trace",
|
|
27
|
+
"nudo/check",
|
|
28
|
+
"nudo/hover",
|
|
29
|
+
"nudo/test",
|
|
30
|
+
"nudo/contract",
|
|
31
|
+
"nudo/contract.draft",
|
|
32
|
+
"nudo/contract.emit"
|
|
33
|
+
];
|
|
34
|
+
var NUDO_AGENT_TOOL_NAMES = [
|
|
35
|
+
"whatIf",
|
|
36
|
+
"suggestCase",
|
|
37
|
+
"trace",
|
|
38
|
+
"check",
|
|
39
|
+
"hover",
|
|
40
|
+
"test",
|
|
41
|
+
"contract",
|
|
42
|
+
"contract.draft",
|
|
43
|
+
"contract.emit"
|
|
44
|
+
];
|
|
45
|
+
var NUDO_INITIALIZE_CAPABILITIES = [
|
|
46
|
+
"textDocumentSync",
|
|
47
|
+
"hoverProvider",
|
|
48
|
+
"completionProvider",
|
|
49
|
+
"codeLensProvider",
|
|
50
|
+
"inlayHintProvider",
|
|
51
|
+
"definitionProvider",
|
|
52
|
+
"referencesProvider",
|
|
53
|
+
"renameProvider",
|
|
54
|
+
"documentSymbolProvider",
|
|
55
|
+
"workspaceSymbolProvider",
|
|
56
|
+
"codeActionProvider",
|
|
57
|
+
"signatureHelpProvider",
|
|
58
|
+
"semanticTokensProvider",
|
|
59
|
+
"executeCommandProvider",
|
|
60
|
+
"diagnosticProvider"
|
|
61
|
+
];
|
|
62
|
+
function slashToExecuteCommand(slash) {
|
|
63
|
+
return slash.replace(/^nudo\//, "nudo.");
|
|
64
|
+
}
|
|
65
|
+
var NUDO_LSP_PACKAGE_SURFACE = {
|
|
66
|
+
name: "@nudojs/lsp",
|
|
67
|
+
bin: "nudo-lsp",
|
|
68
|
+
entry: ".",
|
|
69
|
+
entryPath: "./dist/server.js",
|
|
70
|
+
files: ["dist"],
|
|
71
|
+
/** Machine-readable freeze inventory (no server side effects). */
|
|
72
|
+
publicApiExport: "./public-api",
|
|
73
|
+
publicApiPath: "./dist/public-api.js"
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
NUDO_AGENT_TOOL_NAMES,
|
|
77
|
+
NUDO_EXECUTE_COMMANDS,
|
|
78
|
+
NUDO_INITIALIZE_CAPABILITIES,
|
|
79
|
+
NUDO_LSP_PACKAGE_SURFACE,
|
|
80
|
+
NUDO_SLASH_REQUESTS,
|
|
81
|
+
slashToExecuteCommand
|
|
82
|
+
};
|
package/dist/server.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { TextDocuments, Connection } from 'vscode-languageserver/node';
|
|
3
|
+
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
|
+
|
|
5
|
+
/** Wiring result: documents store + transport start (bin entry calls listen). */
|
|
6
|
+
type NudoServerHandle = {
|
|
7
|
+
documents: TextDocuments<TextDocument>;
|
|
8
|
+
/** Start the JSON-RPC transport. Not called in tests. */
|
|
9
|
+
listen: () => void;
|
|
10
|
+
};
|
|
2
11
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
12
|
+
* Register the full Nudo LSP surface on `connection`.
|
|
13
|
+
* Importable without side effects — the real transport (`createConnection`)
|
|
14
|
+
* is created only by the bin entry below.
|
|
5
15
|
*/
|
|
6
|
-
declare
|
|
7
|
-
/** 注册 watched-files 监听器,返回注销函数。 */
|
|
8
|
-
declare function registerWatchedFilesListener(listener: (uris: string[]) => void): () => void;
|
|
16
|
+
declare function createNudoServer(connection: Connection): NudoServerHandle;
|
|
9
17
|
|
|
10
|
-
export {
|
|
18
|
+
export { type NudoServerHandle, createNudoServer };
|