Skip to main content

Module runtime

Module runtime 

Source
Expand description

第三方 Rust 插件的 JSON-RPC 运行时。

运行时采用三任务异步架构:

  • read_task:唯一 stdin 读取者,解析 LSP 帧,路由响应到 pending_map, 转发请求到 dispatch_task。
  • write_task:唯一 stdout 写入者,将所有出站消息编码为 LSP 帧。
  • dispatch_task:处理 plugin/* 请求,调用用户 Plugin trait 实现, 将响应发到 write_task。

HostProxy 通过共享的 pending_map 和 outbound_tx 发送 host/* 请求, 避免了同步 BufReader 造成的死锁问题。

Structs§

PluginApp
SDK 组件集合:一个 Plugin 主组件 + 任意个 DataSource / ActionExecutor / SearchEngine / ScoreBooster / KeywordOptimizer / KeywordInjector 附加组件。

Functions§

host
返回当前运行时的 HostProxy。 在 run() 之前调用会 panic。
run
使用给定的 Plugin 实现运行 JSON-RPC stdio 循环。 等价于 PluginApp::new(plugin).run()。