Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
node_modules/
/shared/plugins/sdk/java/**/target/
/shared/plugins/sdk/rust/target/
/shared/plugins/sdk/go/bin/
*.tmp
.DS_Store
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ node scripts/rust-core/verify-platform-tests.mjs # 每个测试都在所
scripts/rust-core/verify-rust-core-comments.sh # 注释规范
node scripts/logging/generate-log-events.mjs --check # 日志事件目录与生成表一致
node shared/plugins/scripts/verify-docs.mjs # 契约 $id 与文档链接
node shared/plugins/scripts/sdk-e2e.mjs # 三个 SDK 对当前 Core 的端到端测试
node shared/plugins/scripts/sdk-e2e.mjs # 四个 SDK 对当前 Core 的端到端测试
```

修改 `shared/plugins/contract/v1/`、`rust/crates/plugin-model/src/capabilities.rs` 或
Expand Down Expand Up @@ -59,7 +59,7 @@ node scripts/rust-core/verify-platform-tests.mjs # every test runs on a
scripts/rust-core/verify-rust-core-comments.sh # comment rules
node scripts/logging/generate-log-events.mjs --check # log event catalog matches the generated table
node shared/plugins/scripts/verify-docs.mjs # contract $id values and documentation links
node shared/plugins/scripts/sdk-e2e.mjs # end-to-end tests of the three SDKs against this Core
node shared/plugins/scripts/sdk-e2e.mjs # end-to-end tests of the four SDKs against this Core
```

A pull request that changes `shared/plugins/contract/v1/`, `rust/crates/plugin-model/src/capabilities.rs` or `rust/crates/plugin-rpc/src/` updates the [protocol changelog](shared/plugins/reference/protocol-changelog.md) in the same pull request.
5 changes: 5 additions & 0 deletions rust/crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ name = "plugin_sdk_rust"
path = "../../../shared/plugins/sdk/e2e/plugin_sdk_rust.rs"
required-features = ["plugin-sdk-e2e"]

[[test]]
name = "plugin_sdk_go"
path = "../../../shared/plugins/sdk/e2e/plugin_sdk_go.rs"
required-features = ["plugin-sdk-e2e"]

[[test]]
name = "plugin_sdk_build"
path = "../../../shared/plugins/sdk/e2e/plugin_sdk_build.rs"
Expand Down
48 changes: 34 additions & 14 deletions shared/plugins/README.md

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions shared/plugins/contract/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ previous one. Errors never disclose absolute paths.

A host that advertises `keymapImportProviders` 0 implements the scoped reader.
A host advertises the capability only with the complete import workflow. The official Node,
Java and Rust SDKs implement `litheKeymapImport` 0.
Java, Rust and Go SDKs implement `litheKeymapImport` 0.

## Package layout

Expand Down Expand Up @@ -4748,10 +4748,22 @@ used as a Git dependency pinned by the tag. It enforces the same rules: on Unix
points stdout at stderr so only protocol frames reach the host, and a panic
ends only its call, reported like any unexpected failure.

[`sdk/go`](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/sdk/go/README.md) is the Go SDK for
[plugin backends](#plugin-backend), which ship as packaged executables. It
implements this protocol with its host services and `litheKeymapImport`, but
neither build nor VCS providers. It needs Go 1.22 or newer, uses only the
standard library, and is released as Go module tags
(`shared/plugins/sdk/go/v<version>`) that plugins pin through `go.sum`. It
enforces the same rules: on Unix it moves the protocol to a duplicate of the
stdout descriptor and points stdout at stderr so only protocol frames reach the
host, and a panic in a handler ends only that call, reported like any
unexpected failure.

The Node.js and Java SDKs each have a sample build provider
(`sdk/*/examples/sample-build`) that answers one end-to-end scenario driven
through a real Core session; the Rust SDK's sample backend
(`sdk/rust/examples/sample-backend`) answers a plugin backend scenario in which
through a real Core session; the Rust and Go SDKs' sample backends
(`sdk/rust/examples/sample-backend`, `sdk/go/examples/sample-backend`) answer
the same plugin backend scenario, in which
the test plays the host: it serves the credential requests and the
workspace, file watch and window requests, delivers a command and a context
change, and checks that cancellation reaches the host. That repository runs
Expand Down
4 changes: 2 additions & 2 deletions shared/plugins/guides/debug-adapter-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Lithe 的调试控制台有输入行和补全弹窗。补全来自适配器的 D
`process.executable` 只能是清单 `requiresTools` 列出的工具定义 ID,或插件包内的文件。运行结束时宿主发 `run/didExit` 通知。

这三个方法能否调用,以宿主 `getCapabilities` 的返回为准。Lithe 桌面端的能力声明注释把 run 与 debug 服务列为尚未注册,目前不要假定它们可用。
官方 Node、Java、Rust SDK 还没有 `debug/start`、`run/start`、`run/stop` 的封装,需要时可以用 SDK 的通用宿主请求,以完整方法名调用,
官方 Node、Java、Rust、Go SDK 还没有 `debug/start`、`run/start`、`run/stop` 的封装,需要时可以用 SDK 的通用宿主请求,以完整方法名调用,
例如 Node SDK 的 `backend.host.request(method, params?)`,见 [Host services](../sdk/node/README.md#host-services)。

细节见[调试适配器](../reference/domains/debug-adapters.md)和契约的
Expand Down Expand Up @@ -364,7 +364,7 @@ A plugin with a backend (`requires.backend`) can decide which debug session to s
`process.executable` can only be a tool-definition ID listed in the manifest's `requiresTools`, or a file inside the plugin package. The host sends the `run/didExit` notification when the run ends.

Whether these three methods can be called is decided by what the host returns from `getCapabilities`. The Lithe desktop app's capability declaration comment lists the run and debug services as not yet registered, so do not assume they are available.
The official Node, Java, and Rust SDKs do not wrap `debug/start`, `run/start`, or `run/stop` yet; where needed, call them with the SDK's generic host request using the full method name,
The official Node, Java, Rust, and Go SDKs do not wrap `debug/start`, `run/start`, or `run/stop` yet; where needed, call them with the SDK's generic host request using the full method name,
for example `backend.host.request(method, params?)` in the Node SDK, see [Host services](../sdk/node/README.md#host-services).

For details, see [Debug adapters](../reference/domains/debug-adapters.md) and
Expand Down
4 changes: 2 additions & 2 deletions shared/plugins/guides/lsp-plugin-lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ shasum -a 256 dist/lua-support-0.3.1-darwin-arm64.zip
服务器交出的文档没有对应文件(例如反编译的库类)时,用 `documents/registerContentProvider` 提供:用户打开该 scheme 的文档时,
宿主调用绑定的函数取只读内容(最多 1 MiB,宿主等 30 秒)。每个工作区窗口每个 scheme 只能有一个 provider,用 `subscriptions/dispose` 撤销。

边界:声明 `remote: "unsupported"` 的服务器不在远程工作区启动。官方 Node、Java、Rust SDK 还没有这些方法的专用封装,
边界:声明 `remote: "unsupported"` 的服务器不在远程工作区启动。官方 Node、Java、Rust、Go SDK 还没有这些方法的专用封装,
可以用 SDK 的通用宿主请求,以完整方法名调用,例如 Node SDK 的 `backend.host.request(method, params?)`,
见 [Host services](../sdk/node/README.md#host-services)。桌面端只注册自己实现的宿主服务,
调用前用 `supports(method)` 确认。
Expand Down Expand Up @@ -721,7 +721,7 @@ a server of another plugin returns `plugin.host.foreignContribution`):
When the server hands out documents that have no file (for example the decompiled source of a library class), serve them with `documents/registerContentProvider`: when the user opens a document of that scheme,
the host calls the bound function for its read-only content (at most 1 MiB; the host waits 30 seconds). Each workspace window can have one provider per scheme; revoke it with `subscriptions/dispose`.

Limits: a server that declares `remote: "unsupported"` does not start in a remote workspace. The official Node, Java, and Rust SDKs do not wrap these methods yet;
Limits: a server that declares `remote: "unsupported"` does not start in a remote workspace. The official Node, Java, Rust, and Go SDKs do not wrap these methods yet;
until they do, call them with the SDK's generic host request using the full method name,
for example `backend.host.request(method, params?)` in the Node SDK, see [Host services](../sdk/node/README.md#host-services). The desktop registers only the host services it implements,
so confirm with `supports(method)` before calling.
Expand Down
8 changes: 4 additions & 4 deletions shared/plugins/guides/native-build-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

插件可以只提供工作区后端,不创建网页。用户从原生工具窗口执行构建、发现与运行测试、准备应用启动;宿主继续管理工作区、取消、输出和应用进程。

这些入口都属于 `buildProviders`(版本 `0`):清单要求 `requires.buildProviders: 0`,进程协议 `litheBuild` 的版本就是 `buildProviders` 的版本。Node.js SDK 0.5.0 和 Java SDK 0.5.0 实现了全部入口;Rust SDK 0.4.0 没有构建提供者接口。能力定义见[构建提供者](../reference/domains/build-providers.md),字段和错误码以[契约](../contract/v1/README.md#build-providers)为准。
这些入口都属于 `buildProviders`(版本 `0`):清单要求 `requires.buildProviders: 0`,进程协议 `litheBuild` 的版本就是 `buildProviders` 的版本。Node.js SDK 0.5.0 和 Java SDK 0.5.0 实现了全部入口;Rust SDK 0.4.0 和 Go SDK 没有构建提供者接口。能力定义见[构建提供者](../reference/domains/build-providers.md),字段和错误码以[契约](../contract/v1/README.md#build-providers)为准。

> **宿主支持。** Lithe 桌面端声明 `buildSystems` 和 `buildProviders`:构建窗口发现构建实例、加载提供者模型、解析可执行文件候选并运行任务。构建提供者的运行准备、测试、调试准备、model inputs、原生配置、内联测试报告和运行时调试,桌面端尚未呈现,见
> [`pluginhost.go`](https://github.com/1lck/Lithe-IDEA/blob/main/desktop/internal/pluginhost/pluginhost.go) 中 `Declared()` 上方的注释。下文的入口因此由 Core 与 SDK 的端到端测试验证,插件作者在桌面端界面里暂时看不到测试、运行和调试这几类入口的效果。
Expand Down Expand Up @@ -82,7 +82,7 @@ node --test shared/plugins/scripts/*.test.mjs
node shared/plugins/scripts/sdk-e2e.mjs
```

`sdk-e2e.mjs` 先构建三个 SDK 的示例后端,再用 `cargo test -p lithe-core --features plugin-sdk-e2e` 运行 `plugin_sdk_node`、`plugin_sdk_java`、`plugin_sdk_rust` 和 `plugin_sdk_build`,被测对象是当前工作树里的 Core,所以改 Core 与改 SDK 或契约可以在同一个 PR 里一起验证。运行需要 Rust、Node.js 20.3 或更高版本、Java(用 `LITHE_PLUGIN_SDK_JAVA_RUNTIME` 指定,或放在 `PATH` 上的 `java`)和 Maven。
`sdk-e2e.mjs` 先构建四个 SDK 的示例后端,再用 `cargo test -p lithe-core --features plugin-sdk-e2e` 运行 `plugin_sdk_node`、`plugin_sdk_java`、`plugin_sdk_rust`、`plugin_sdk_go` 和 `plugin_sdk_build`,被测对象是当前工作树里的 Core,所以改 Core 与改 SDK 或契约可以在同一个 PR 里一起验证。运行需要 Rust、Node.js 20.3 或更高版本、Go 1.22 或更高版本、Java(用 `LITHE_PLUGIN_SDK_JAVA_RUNTIME` 指定,或放在 `PATH` 上的 `java`)和 Maven。

这些测试通过真实 Core 规划与解码,覆盖构建非零退出码、精确筛选、运行前构建、准备计划、进度、取消后的工具清理、并行工作区隔离,以及包含 SDK 和 JAR 的完整包文件不变。它们不代替原生界面、真实 Maven/JDT 工程或桌面端实机验证。

Expand All @@ -104,7 +104,7 @@ node shared/plugins/scripts/sdk-e2e.mjs

A plugin can provide only a workspace backend and create no web page. Users build, discover and run tests, and prepare application launches from native tool windows; the host keeps managing the workspace, cancellation, output, and application processes.

These entry points all belong to `buildProviders` (version `0`): the manifest requires `requires.buildProviders: 0`, and the version of the `litheBuild` process protocol is the version of `buildProviders`. Node.js SDK 0.5.0 and Java SDK 0.5.0 implement every entry point; Rust SDK 0.4.0 has no build-provider interface. For the capability see [Build providers](../reference/domains/build-providers.md); the [contract](../contract/v1/README.md#build-providers) is normative for fields and error codes.
These entry points all belong to `buildProviders` (version `0`): the manifest requires `requires.buildProviders: 0`, and the version of the `litheBuild` process protocol is the version of `buildProviders`. Node.js SDK 0.5.0 and Java SDK 0.5.0 implement every entry point; Rust SDK 0.4.0 and the Go SDK have no build-provider interface. For the capability see [Build providers](../reference/domains/build-providers.md); the [contract](../contract/v1/README.md#build-providers) is normative for fields and error codes.

> **Host support.** The Lithe desktop declares `buildSystems` and `buildProviders`: the Build window detects build instances, loads provider models, resolves executable candidates, and runs tasks. Build-provider run preparation, tests, debug preparation, model inputs, native configuration, inline test reports, and runtime debugging are not presented on the desktop yet; see the comment above `Declared()` in
> [`pluginhost.go`](https://github.com/1lck/Lithe-IDEA/blob/main/desktop/internal/pluginhost/pluginhost.go). The entry points below are therefore verified by the Core and SDK end-to-end tests, and a plugin author cannot yet see the effect of the test, run, and debug entry points in the desktop UI.
Expand Down Expand Up @@ -180,7 +180,7 @@ node --test shared/plugins/scripts/*.test.mjs
node shared/plugins/scripts/sdk-e2e.mjs
```

`sdk-e2e.mjs` first builds the three SDKs' sample backends, then runs `plugin_sdk_node`, `plugin_sdk_java`, `plugin_sdk_rust`, and `plugin_sdk_build` with `cargo test -p lithe-core --features plugin-sdk-e2e`. The code under test is the Core in the working tree, so a change to Core and a change to an SDK or the contract are verified together in one PR. It needs Rust, Node.js 20.3 or newer, Java (set with `LITHE_PLUGIN_SDK_JAVA_RUNTIME`, or `java` on `PATH`), and Maven.
`sdk-e2e.mjs` first builds the four SDKs' sample backends, then runs `plugin_sdk_node`, `plugin_sdk_java`, `plugin_sdk_rust`, `plugin_sdk_go`, and `plugin_sdk_build` with `cargo test -p lithe-core --features plugin-sdk-e2e`. The code under test is the Core in the working tree, so a change to Core and a change to an SDK or the contract are verified together in one PR. It needs Rust, Node.js 20.3 or newer, Go 1.22 or newer, Java (set with `LITHE_PLUGIN_SDK_JAVA_RUNTIME`, or `java` on `PATH`), and Maven.

These tests plan and decode through a real Core and cover a non-zero build exit code, exact filtering, build before run, preparation plans, progress, tool cleanup after cancellation, isolation between parallel workspaces, and an unchanged complete package including the SDK and JAR. They do not replace verification of the native UI, real Maven/JDT projects, or the desktop on a real machine.

Expand Down
Loading
Loading