feat: improve debug variables order and fix console log#4533
Conversation
|
""" Walkthrough本次变更主要包括对调试树节点排序逻辑的调整、树节点父级处理的细节优化、调试控制台清屏提示文案的修正、调试变量视图缩进像素的微调、消息类型枚举新增 Log 成员,以及调试控制台树节点颜色样式的调整。所有改动均未涉及对外部导出接口的声明修改。 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant DebugConsole
participant Localization
User->>DebugConsole: 发送清屏指令(ANSI序列)
DebugConsole->>Localization: 获取 'debug.console.consoleCleared' 文案
Localization-->>DebugConsole: 返回本地化字符串
DebugConsole-->>User: 在控制台插入清屏提示
sequenceDiagram
participant TreeNode
participant ParentNode
TreeNode->>ParentNode: mv(to)
alt to 为 null 或非 CompositeTreeNode
TreeNode->>TreeNode: _parent = undefined
TreeNode->>TreeNode: dispose()
else to 为 CompositeTreeNode
TreeNode->>ParentNode: 正常迁移逻辑
end
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
yarn install v1.22.22 Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (4)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (9)
🔇 Additional comments (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/debug/src/browser/view/variables/debug-variables.view.tsx (1)
193-194: 考虑使用可选链优化代码静态分析工具建议在这里使用可选链表达式来简化代码并提高可读性。
- const paddingLeft = `${ - (defaultLeftPadding || 8) + (item.depth || 0) * (leftPadding || 0) + (ExpressionContainer.is(item) ? 0 : 18) - }px`; + const paddingLeft = `${ + (defaultLeftPadding ?? 8) + (item.depth ?? 0) * (leftPadding ?? 0) + (ExpressionContainer.is(item) ? 0 : 18) + }px`;🧰 Tools
🪛 Biome (1.9.4)
[error] 193-194: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
packages/components/src/recycle-tree/tree/TreeNode.ts(1 hunks)packages/debug/src/browser/tree/debug-tree-node.define.ts(2 hunks)packages/debug/src/browser/view/console/debug-console-session.ts(1 hunks)packages/debug/src/browser/view/variables/debug-variables.view.tsx(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/debug/src/browser/tree/debug-tree-node.define.ts (1)
packages/components/src/recycle-tree/tree/TreeNode.ts (1)
CompositeTreeNode(361-1882)
🪛 Biome (1.9.4)
packages/debug/src/browser/view/variables/debug-variables.view.tsx
[error] 193-194: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: unittest (ubuntu-latest, 18.x, jsdom)
- GitHub Check: unittest (macos-latest, 18.x, jsdom)
- GitHub Check: unittest (macos-latest, 18.x, node)
- GitHub Check: unittest (ubuntu-latest, 18.x, node)
- GitHub Check: ubuntu-latest, Node.js 20.x
- GitHub Check: build-windows
- GitHub Check: build (ubuntu-latest, 20.x)
- GitHub Check: build (macos-latest, 20.x)
🔇 Additional comments (5)
packages/debug/src/browser/view/console/debug-console-session.ts (1)
111-111: 修复了控制台清屏消息的本地化键值将本地化键从原来错误的拼写
'debug.console.consoleCleare'更正为'debug.console.consoleCleared',确保在控制台被清除时显示正确的提示信息。packages/debug/src/browser/view/variables/debug-variables.view.tsx (1)
194-194: 优化了非ExpressionContainer节点的缩进距离将非ExpressionContainer类型节点的左侧缩进从16px增加到18px,提升了变量树视图的可读性和层次感。这种微调有助于更清晰地区分不同类型的调试变量节点。
🧰 Tools
🪛 Biome (1.9.4)
[error] 193-194: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
packages/components/src/recycle-tree/tree/TreeNode.ts (1)
312-312: 优化了节点父级引用的处理逻辑当目标父节点为null或非CompositeTreeNode时,直接设置
_parent属性而非通过setter,避免了额外的路径重置逻辑,这是一个细微但有效的优化。packages/debug/src/browser/tree/debug-tree-node.define.ts (2)
117-128: 改进了变量排序逻辑,提升了用户体验修改后的排序算法做了以下几个关键改进:
- 使用
displayName或name作为排序依据,更符合用户直观认知- 将字母数字字符排在符号字符之前,符合常见的排序习惯
- 采用区域感知的数字排序(
localeCompare的numeric:true选项),使得"变量10"能正确排在"变量2"之后- 提供了更一致、更符合直觉的变量显示顺序
这些改进使得调试过程中的变量排序更加直观和易用。
129-129: 优化了复合节点和普通节点的排序优先级调整了复合节点(CompositeTreeNode)的排序优先级,现在将复合节点(如对象、数组等可展开的变量)排在普通节点之前,这与标准的调试器行为保持一致,更加符合用户预期。
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4533 +/- ##
==========================================
- Coverage 52.90% 52.89% -0.01%
==========================================
Files 1677 1677
Lines 103326 103331 +5
Branches 22387 22381 -6
==========================================
- Hits 54660 54658 -2
- Misses 40487 40492 +5
- Partials 8179 8181 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/next |
|
/next |
|
🎉 PR Next publish successful! 3.8.3-next-1747014731.0 |
Types
Background or solution
优化调试变量顺序展示(更符合直觉习惯)


修复 Python 调试无法在控制台 print 的问题
Changelog
improve debug variables order and fix console log
Summary by CodeRabbit