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
12 changes: 8 additions & 4 deletions desktop/internal/workbench/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,13 +568,15 @@ func awaitCoreLaunch(t *testing.T, h *harness, p *project, session pluginservice
}

// A plugin run with a launch debug target hands its process to the adapter: Core binds
// the run's program, arguments, directory and environment into the launch, and the run
// learns when the session ends.
// the run's program, arguments, directory and environment into the launch, fills the
// adapter's own arguments from the program's path, adds a variable to the environment,
// and the run learns when the session ends.
func TestRunLaunchTargetBindsTheRunsProcessIntoTheLaunch(t *testing.T) {
manifest := debugFixtureManifest
manifest = strings.Replace(manifest, `"configurations": {"launch":{"arguments":{"stopOnEntry":true}}}`,
`"configurationTypes": ["fixture"], "configurations": {"launch":{"arguments":{"stopOnEntry":true},`+
`"targetBindings":{"program":"target.path","cwd":"target.workingDirectory","args":"target.arguments","env":"target.environment"}}}`, 1)
`"targetBindings":{"program":"target.path","cwd":"target.workingDirectory","args":"target.arguments","env":"target.environment",`+
`"adapterArguments":{"fixture.programDirectory":"target.directory","env.FIXTURE_DIRECTORY":"target.directory"}}}}`, 1)
h := debugHarnessWith(t, manifest)
root := t.TempDir()
// The fixture adapter only serves a workspace carrying its marker; without it the
Expand Down Expand Up @@ -608,7 +610,9 @@ func TestRunLaunchTargetBindsTheRunsProcessIntoTheLaunch(t *testing.T) {
arguments := awaitCoreLaunch(t, h, p, result.session, gate.configurations).Arguments
args, _ := arguments["args"].([]any)
env, _ := arguments["env"].(map[string]any)
if arguments["program"] != program || arguments["cwd"] != root || len(args) != 2 || args[0] != "--port" || env["APP_MODE"] != "dev" {
fixture, _ := arguments["fixture"].(map[string]any)
if arguments["program"] != program || arguments["cwd"] != root || len(args) != 2 || args[0] != "--port" ||
env["APP_MODE"] != "dev" || env["FIXTURE_DIRECTORY"] != root || fixture["programDirectory"] != root {
t.Fatalf("launch arguments = %+v", arguments)
}
// The release ends on a background goroutine that may post nothing, so the waiter
Expand Down
10 changes: 9 additions & 1 deletion scripts/desktop/build-desktop-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ native_path() {
}

PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git"
# Lithe-core-rust #55, the head of its branch until it is merged: a debug configuration's
# targetBindings.adapterArguments fills arguments only that adapter defines from a path fact of
# the target, dotted like a connection destination, with env.<variable> adding one variable to
# the environment (Delve's dlvCwd and env.PWD, so go build runs in the package's directory), and
# targetBindings.cwd may read target.directory so the program runs there too rather than in the
# workspace root the debug engine gives a launch without cwd. It is
# on top of #54, squash-merged into main as dce448d: workbench.notifications.reduceReadState keeps
# the unread notifications and their count, which the desktop does not call yet. It is on top of
# Lithe-core-rust #53, squash-merged into main as c550c2b: a plugin declares commandInstallers that
# install the commands its systemCommand launches need with an injected tool, and Core expands
# them (plugins.commandInstallers.requirements/plan/defaultDirectory). It is on top of
Expand Down Expand Up @@ -109,7 +117,7 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git"
# the contract, plugin guides, reference and SDKs live only in shared/plugins; on top of #16 (reported Git queries folded in the console),
# #15 (git.write cherryPick, revert and reset fields), #14 (word-level changed ranges of diff
# rows), #13, #8, #7, #6 and #4.
PINNED_CORE_REVISION="c550c2bf10b4d82d2315e737bf83a007daafaa56"
PINNED_CORE_REVISION="268d9a2937a6d49708a05ba36c98562c79e5119c"
PROFILE="debug"
while [[ $# -gt 0 ]]; do
case "$1" in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"owner": "Debug",
"verification": "macOS:安装声明了 debugAdapters 的插件,在其语言文件上启动调试,确认适配器按声明的 stdio 传输由宿主拉起并命中断点;可执行文件缺失时显示插件设置里的安装提示而不是笼统错误;声明 tcpPort 传输的适配器在启动进程前被拒绝并说明原因。声明 tcpAnnounced 传输的适配器由宿主拉起进程,按 Core 的 debug.adapters.readAnnouncement 逐行读取声明的输出流:公告行不进调试控制台,其余输出照常显示;公告回环端点后连接并命中断点,暂停/继续正常,停止时先送达 disconnect 再停止进程;公告前退出显示“还没输出监听端口就退出”,公告非本机地址显示端点无效并停止进程,10 秒内没有公告按启动超时结束并停止进程。声明 tcpLanguageServer 传输的适配器(调试服务随同一插件的语言服务器运行)不由宿主拉起进程:宿主启动该插件声明的语言服务器,用 endpoint.command 向它要端口并连接 127.0.0.1,端口无效、语言服务器不属于该插件或不可用时会话以原因结束。从保存配置直接启动且未打开源码时也会激活、登记语言服务器并探测工具;停止调试取消端口命令而不停止共享语言服务器,拒绝工作区或会话替换后的旧端口。适配器只声明 attach,或 selectors 的 targetKinds 不含 file 时,不会被选作文件启动的调试器。capabilities.disabled 中的能力在调试会话里不可用,并随 debug.createSession 传给 Core。会话进行中禁用、更新或卸载该插件,或在模块设置里停用它,只停止该插件拥有的会话,同语言其他插件的会话继续运行。启动后 app bundle 文件清单不变(scripts/desktop/verify/verify-runtime-bundle-immutability.sh)。远程 attach 目前只有 Core 契约:attach 配置可声明 targetBindings.connection,Core 校验主机、端口与路径映射并按适配器自己的参数路径写入启动参数,非 localhost、127.0.0.0/8、::1 的端点返回 remote:true;macOS 宿主尚未接入 attach 与“附加到远程”对话框,因此本项暂不能在应用里验证远程附加,接入后补充:连接新的非回环端点前必须弹确认且默认不记住,附加结束只断开不结束远端程序。Windows:宿主尚未接入 debugAdapters,Core 校验通过不代表 Windows 能调试插件语言。 原生宿主路由回归:使用 Core 的 rust/fixtures/debug/adapter-selection-v1.json 验证自动文件选择、明确身份、无源文件目标、空身份、已撤回身份和 launch/attach 不匹配;同语言多个适配器分别收到断点,重试保持身份,附加会话启动失败保留原会话。这里只验证宿主交接与受控会话,Provider 原生程序准备 RPC 有受控流程与真实 SDK 进程覆盖;真实适配器的完整工作流与 Windows 接入仍未验收。 真实原生调试集成:公开 Node SDK Provider 用 Clang 编译 C 程序,经生产 macOS 会话、Core 准备、Registry 明确身份、生产 stdio 传输和 LLDB 命中源码断点、读取 main 栈帧、保留空格参数后继续并退出码 0;包 SHA-256/权限不变,所有本次进程回收。测试显式选择 SDK/工具,完整 UI、正式发行与 Windows 尚未验收,verification 保持 pending。 与显式 DAP 端点同时使用时,先按当前 Registry 身份校验请求能力,再调用端点工厂;launch/attach 与默认/明确身份的组合回归覆盖不会回退到本地适配器,配置编码与步进变换保留两个字段。 Windows 增量:服务目标显式保存并调试,唯一当前 Registry 类型/身份、Core 连接绑定、stdio/同包语言服务器、完整参数/初始化身份/禁用能力;覆盖重复/缺失适配器、包和设置变化、注册 ABA、监听取消、迟到启动回执、Run 退出/替换、清理失败重试。原生能力准入仍关闭,正式 Windows 适配器与真实框架断点 UI 尚未验收。 日志验收:在最新macOS宿主分别启动、初始化、暂停/继续、正常结束、取消、超时和适配器拒绝,确认debug/<adapter>的关键生命周期INFO、内部状态DEBUG、真实失败ERROR;启动与原生进程非零退出固定stage/exit_code进入debug,原始stderr、DAP正文、源码、变量、内存和程序输出不进入诊断日志。同一次launch失败不能重复记session失败,取消不记ERROR。共享Core组件验证不能替代macOS真实UI和Windows v2验收。",
"notes": "Viva 声明 debugAdapters 0(契约版本已统一归 0,原 1、2、3 的内容都在其中):stdio、tcpAnnounced(宿主拉起进程,读取它输出的回环端口后连接)与 tcpLanguageServer 适配器、launch 与 attach、远程 attach(Core 判定非本机的端点需用户确认,不记住答案;暂无路径映射输入)、features 与 defaults 随 debug.createSession 交给调试引擎。debug/start 宿主方法与 run/start 的 launch 目标已接入;适配器的 startDebugging 子会话已接入(debug_child.go);launch.json 导入与 tcpPort 暂未实现。原生产品验收仍 pending。",
"notes": "Viva 声明 debugAdapters 0(契约版本已统一归 0,原 1、2、3 的内容都在其中):stdio、tcpAnnounced(宿主拉起进程,读取它输出的回环端口后连接)与 tcpLanguageServer 适配器、launch 与 attach、远程 attach(Core 判定非本机的端点需用户确认,不记住答案;暂无路径映射输入)、features 与 defaults 随 debug.createSession 交给调试引擎。debug/start 宿主方法与 run/start 的 launch 目标已接入;适配器的 startDebugging 子会话已接入(debug_child.go);launch.json 导入与 tcpPort 暂未实现。targetBindings.adapterArguments(按路径事实填适配器自有参数,env.<变量> 给环境加一个变量)与 targetBindings.cwd ← target.directory(被调程序在源文件所在目录运行)由共享 Core 在 debug.adapters.startArguments 里填好,宿主不需要改动。原生产品验收仍 pending。",
"legacy": {
"revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36",
"macos": {
Expand Down
Loading