fix: direct debug adapter fix, and runInTerminal fix#4031
Conversation
|
This PR was not deployed automatically as @life2015 does not have access to the Railway project. In order to get automatic PR deploys, please add @life2015 to the project inside the project settings page. |
Walkthrough此次更改主要集中在调试会话的处理上,增强了对调试请求响应的异步处理能力。引入了新的消息读取和写入类,以改善调试适配器协议(DAP)消息的解析和序列化。此外,增加了对JSON配置的防御性检查,以防止因格式不当而导致的运行时错误。 Changes
Suggested labels
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
/next |
There was a problem hiding this comment.
Actionable comments posted: 3
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- packages/debug/src/browser/debug-session-connection.ts (3 hunks)
- packages/extension/src/browser/vscode/contributes/debuggers.ts (1 hunks)
- packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-starter.ts (2 hunks)
Additional comments not posted (4)
packages/debug/src/browser/debug-session-connection.ts (3)
12-12: 修改看起来不错!通过引入
MaybePromise,debug 请求处理程序现在可以返回直接值或 promise,这为异步操作提供了更大的灵活性。
28-28: 类型定义的修改看起来很合理。通过将
DebugRequestHandler的返回类型更改为MaybePromise<any>,与更新后的导入语句保持一致,支持在 debug 请求处理程序中进行异步操作。这使得处理程序能够在提供响应之前执行异步任务。
261-263: 非常重要的修复!在调用请求处理程序时添加
await关键字是一个关键的修复。正如注释中提到的,之前缺少await会导致服务器无法获取预期的结果,特别是在使用集成控制台进行调试时,会导致无法命中断点。通过正确地等待异步操作完成,可以确保服务器接收到预期的结果,从而解决了影响调试功能的关键问题。这个修改非常重要,能够显著改善调试体验。
packages/extension/src/browser/vscode/contributes/debuggers.ts (1)
285-288: 非常好的防御性编程实践!添加这个检查可以提高代码的健壮性,防止由于格式不正确的 JSON 配置导致调试功能完全失败。提前返回可以避免访问 undefined 属性而导致的潜在运行时错误。建议保留这个改动。
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4031 +/- ##
==========================================
- Coverage 54.46% 54.44% -0.03%
==========================================
Files 1583 1583
Lines 96900 96948 +48
Branches 19831 19846 +15
==========================================
+ Hits 52778 52784 +6
- Misses 36647 36684 +37
- Partials 7475 7480 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
🎉 PR Next publish successful! 3.3.4-next-1726743249.0 |
Types
修复 DAP 支持 和 OpenSumi Debug 的错误
修复 directDebugAdapter 无法使用的问题
修复 DAP 调用 runInTerminal 后服务端无法拿到 pid 的问题
🐛 Bug Fixes
Background or solution
目前 OpenSumi Debug 对于 directDebugAdapter 的支持有问题,导致插件注册的 directDebugAdapter 无法正常对接 Debug 能力,表现是 DAP 的 IO 完全不通。重写了这部分 IO 对接逻辑后,问题被解决。
另外 RunInTerminal 也有问题,表现是 Debug 时拉起终端运行程序之后,DAP Server 感知不到 Server 被拉起来,同时也拿不到进程的 pid。发现问题在于 RunInTerminal 在 IDE 侧调用后没有 await,就直接返回空结果给 DAP Server。
Changelog
Summary by CodeRabbit
新功能
错误修复